Authentication - justmarks/SmugMug.NET.v2 GitHub Wiki
There are two forms of authentication when working with SmugMug: Anonymous and OAuth. All APIs exist in the ISmugMugAPI interface and you can instantiate the SmugMugAPI object using either anonymous or oauth credentials.
Anonymous authentication
Anonymous authentication allows read only access to public albums; all create, update and delete APIs will fail.
Anonymous authentication is pretty simple to initialize, though you still need a client key from SmugMug
OAuthCredentials oAuthCredentials = new OAuthCredentials(CONSUMER_KEY); // CONSUMER_KEY is the API Key received from SmugMug`
SmugMugAPI apiAnonymous = new SmugMugAPI(LoginType.Anonymous, new OAuthCredentials(CONSUMER_KEY));
OAuth authentication
SmugMug currently supports OAuth 1.0a. To learn more about OAuth, checkout this guide.
All APIs (get, create, update, and delete) will work when using OAuth but you still need the appropriate permissions for a given user's account, folder, album, etc.
OAuthCredentials oAuthCredentials = new OAuthCredentials(CONSUMER_KEY, CONSUMER_SECRET, oauth_token, oauth_token_secret);
SmugMugAPI apiOAuth = new SmugMugAPI(LoginType.OAuth, oAuthCredentials);
Sample
The Authentication sample is checked into the samples directory of the project.
The sample also includes a method to generate the OAuth token and secret by making calls using the OAuth NuGet package. NOTE: When running the sample the SmugMug website will open and you will have to login and then provide the 6-digit numeric key on the command line.
Be sure to specify your key and secret in app.config