How to use the library in your projects?
Add to your project a reference to the Nemiro.OAuth assembly and import namespace Nemiro.OAuth and Nemiro.OAuth.Clients:
CopyC#
using Nemiro.OAuth; using Nemiro.OAuth.Clients;
CopyVB
Imports Nemiro.OAuth Imports Nemiro.OAuth.Clients
And now you can use classes of the library.
For example, registration the Twitter client in the application:
CopyC#
OAuthManager.RegisterClient ( new TwitterClient ( "cXzSHLUy57C4gTBgMGRDuqQtr", "3SSldiSb5H4XeEMOIIF4osPWxOy19jrveDcPHaWtHDQqgDYP9P" ) );
CopyVB
OAuthManager.RegisterClient _ ( New TwitterClient _ ( "cXzSHLUy57C4gTBgMGRDuqQtr", "3SSldiSb5H4XeEMOIIF4osPWxOy19jrveDcPHaWtHDQqgDYP9P" ) )
And obtaining addresses for authorization:
CopyC#
string url = OAuthWeb.GetAuthorizationUrl("twitter");
CopyVB
Dim url As String = OAuthWeb.GetAuthorizationUrl("twitter")
Verification of the authorization results by URL.
CopyC#
var result = OAuthWeb.VerifyAuthorization("result url"); if (result.IsSuccessfully) { // ..successfully.. }
CopyVB
Dim result As AuthorizationResult = OAuthWeb.VerifyAuthorization("result url") If result.IsSuccessfully Then ' ..successfully.. End If
And get user profile details.
CopyC#
var user = result.UserInfo; // ...
CopyVB
Dim user As UserInfo = result.UserInfo ' ...
In the description of the classes you can find more detailed examples.
If you need real examples of using the library, please download Nemiro.OAuth.