Authorization - adamkrogh/goodreads-dotnet GitHub Wiki

There is an example of authorized Goodreads client.

You can obtain an API key and an API secret here.

// Define your Goodreads key and secret.
const string apiKey = "<Your API Key>";
const string apiSecret = "<Your API Secret>"; 

// Create an unauthorized Goodreads client.
var client = GoodreadsClient.Create(apiKey, apiSecret);

// Ask a Goodreads request token and build an authorization url.
const string callbackUrl = "<callback_url>";
var requestToken = await client.AskCredentials(callbackUrl);

// Then app has to redirect a user to 'requestToken.AuthorizeUrl' and user must grant access to your application.

// Get a user's OAuth access token and secret after they have granted access.
var accessToken = await client.GetAccessToken(requestToken);

// Create an authorized Goodreads client.
var authClient = GoodreadsClient.CreateAuth(apiKey, apiSecret, accessToken.Token, accessToken.Secret);

// Now you are able to call all of the Goodreads endpoints. For example:
// Add a user to friends list
var book = await client.Friends.AddFriend(userId: 1); 

// Add a book to a 'must-read' shelf.
await client.Shelves.AddBookToShelf(shelf: "must-read", bookId: 15979976);