OAuth 1.0 Consumer
| C# | Visual Basic | Visual C++ |
public class OAuthClient
Public Class OAuthClient
public ref class OAuthClient
| All Members | Constructors | Methods | Properties | ||
| Icon | Member | Description |
|---|---|---|
| OAuthClient()()() |
Creates a new instance of OAuthClient.
| |
| AccessTokenUrl |
The URL where Request Tokens can be upgraded to Access Tokens.
| |
| AuthorizeTokenUrl |
The URL where a user will be directed to authorize tokens.
| |
| ConsumerKey |
The OAuth Consumer Key provided by the service provider.
| |
| ConsumerSecret |
The OAuth Consumer Secret privided by the service provider.
| |
| Equals(Object) | (Inherited from Object.) | |
| Finalize()()() | (Inherited from Object.) | |
| GetAccessToken(RequestToken) |
Requests an Access Token from the OAuth Service Provider.
| |
| GetAuthParameters(Uri, String, AccessToken, NameValueCollection, AuthenticationMethod) |
Get a string containing the Authentication parameters that should be
passed in the authentication request. Compatible with standard OAuth
authentication.
| |
| GetAuthParameters(Uri, String, String, NameValueCollection, AuthenticationMethod) |
Get a string containing the Authentication parameters that should be
passed in the authentication request. Compatible with Two-Legged OAuth
authentication.
| |
| GetCredentials(AccessToken, NameValueCollection) |
Using an Access Token, get an ICredentials object that can be
used with WebRequest.
| |
| GetCredentials(String, NameValueCollection) |
Get an ICredentials object for two-legged OAuth authentication.
| |
| GetHashCode()()() | (Inherited from Object.) | |
| GetRedirect(Uri, RequestToken, NameValueCollection) |
Returns the URL that the user should be directed to in order to
upgrade the Request Token to a Access Token.
| |
| GetRequestToken(NameValueCollection) |
Requests a Request Token from the OAuth Service Provider.
| |
| GetType()()() | (Inherited from Object.) | |
| MemberwiseClone()()() | (Inherited from Object.) | |
| RegisterAuthenticationModule()()() |
Register the OAuth Authentication Module.
| |
| RequestTokenUrl |
The URL where Request Tokens can be requested.
| |
| RsaCertificate |
The X509 certificate containing the private key used for the RSA-SHA1 signing method.
Optional for other signing methods.
| |
| SignatureType |
The signature signing method that will be used.
| |
| TokenRequestFormat |
The HTTP request method and authentication arugment
format that will be used to request tokens
from the service provider.
| |
| ToString()()() | (Inherited from Object.) |
Implements OAuth 1.0 Core, with support for two-legged OAuth.
First, initialize the OAuth Consumer.
OAuthClient client = new OAuthClient() { ConsumerKey = "key_from_provider", ConsumerSecret = "secret_from_provider", RequestTokenUrl = new Uri("http://requestTokenUrl/from/provider"), AuthorizeTokenUrl = new Uri("http://authorizeurl/from/provider"), AccessTokenUrl = new Uri("http://accessTokenUrl/from/provider") };
Then, get a Request Token from the service provider.
// Get a Request Token RequestToken requestToken = client.GetRequestToken(null); // Get user approval for the Token, directing the service provider // to send the user to the CallbackUri when finished Response.Redirect(client.GetRedirect(new Uri("http://this/url"), requestToken, null));
Once the user has approved the request for a token, you can then request the permanent Access Token.
AccessToken accessToken = client.GetAccessToken(requestToken);
Once the Access Token is received, save it, associated with that user. Any time you want to get that user's information from the service provider, just do a normal WebRequest with the OAuth credentials.
WebRequest request = WebRequest.Create(new Uri("http://api/url")); request.Credentials = client.GetCredentials(accessToken, null);
| Object | |
| OAuthClient | |