Zebble.OAuth
A Zebble plugin to make OAuth authentication request.
This plugin enables you to authenticate users via standard authentication mechanism (OAuth) in Zebble applications and it is implemented for Android and iOS platforms.
Setup
- Available on NuGet: https://www.nuget.org/packages/Zebble.OAuth/
- Install in your platform client projects.
- Available for iOS, Android.
Api Usage
To authenticate users you need to use OAuth object and set some parameters like below:
var auth = new Zebble.OAuth("clientId","scope", "authorizeURL", "redirectURL");
await auth.Authenticate();
auth.AuthCompleted.Handle(arg =>
{
if (arg.IsAuthenticated)
{
//send some request
}
});
Facebook Sample
var auth = new Zebble.OAuth("appId", "", "https://m.facebook.com/dialog/oauth/", "fb" + "appId" + "://authorize");
await auth.Authenticate();
auth.AuthCompleted.Handle(arg =>
{
if (arg.IsAuthenticated)
{
//send some request
}
});
Microsoft Sample
var auth = new Zebble.OAuth("appId", "your secret id", "scope (ex: wl.imap)",
"https://login.live.com/oauth20_authorize.srf", "msal" + "appId" + "://auth", "https://login.live.com/oauth20_token.srf");
await auth.Authenticate();
auth.AuthCompleted.Handle(arg =>
{
if (arg.IsAuthenticated)
{
//send some request
}
});
Properties
Property | Type | Android | iOS | Windows |
---|---|---|---|---|
ClientId | string | x | x | |
Scope | string | x | x | |
AuthorizeUrl | string | x | x | |
AccessTokenUrl | string | x | x | |
ConsumerKey | string | x | x | |
ConsumerSecret | string | x | x | |
RequestTokenUrl | string | x | x |
Events
Event | Type | Android | iOS | Windows |
---|---|---|---|---|
AuthCompleted | AsyncEvent<AuthCompletedEventArgs> | x | x |
Methods
Method | Return Type | Parameters | Android | iOS | Windows |
---|---|---|---|---|---|
OAuth1Request | Task<TResult> | method -> RequestMethods, url -> string, account -> OAuthAccount, parameters -> Dictionary<string, string>, includeMultipart -> bool | x | x | |
OAuth2Request | Task<TResult> | method -> RequestMethods, url -> string, account -> OAuthAccount, parameters -> Dictionary<string, string> | x | x | |
AddMultipartData | void | name -> string, data -> string | x | x | |
AddMultipartData | void | name -> string, data -> Stream, mimeType -> string, filename -> string | x | x | |
Authenticate | Task | - | x | x |