-
Couldn't load subscription status.
- Fork 30
3 legged OAuth using the wrapper
In order to generate an OAuth authenticated user token, you can do the following:
- Obtain a Request Token
- Redirect user to our OAuth authentication microsite to authenticate
- Use request token to obtain an Access Token.
var api = new ApiFactory(new ApiUri(), new AppSettingsCredentials());
var requestToken = await api.Create<OAuthRequestToken>()
.Please();
ApiUri is a basic object that inherits from IApiUri containing the 7digital api url.
e.g.
https://github.com/7digital/SevenDigital.Api.Wrapper/blob/master/examples/ExampleUsage/ExampleUsage/ApiUri.cs
AppSettingsCredentials is an object inheriting from IOAuthCredentials pointing at somewhere that has access to your api key / secret. e.g:
Details of the web-page where access can be granted is here: http://developer.7digital.com/resources/133
Replace YOUR_KEY_HERE with your api key, and oauth_token / oauth_secret with the ones returned by the call to the request/token endpoint above.
var accessTokenTokenApi = await api.Create<OAuthAccessToken>()
.ForUser(requestToken.Token, requestToken.Secret)
.Please();
There is an api Request Token authentication endpoint, which requires a Premium api account to take advantage of.