Hi,
We are using Xamarin.OAuth 2.0 for allowing user to login app using Identity provider, OAuth is working fine until getting Access_Token and Refresh_Token.
But we are not sure how to use Refresh_Token using OAuth sdk in order to get Access_Token .
public MyAccountAuthenticator(string clientId, string clientSecret, string scope, string redirectUrl, IMyAccountAuthenticationDelegate authenticationDelegate)
{
_authenticationDelegate = authenticationDelegate;
_auth = new OAuth2Authenticator(clientId, clientSecret, "",
new Uri(AuthorizeUrl),
new Uri(redirectUrl),
new Uri(AccessTokenUrl),
null, IsUsingNativeUI);
_auth.Completed += OnAuthenticationCompleted;
_auth.Error += OnAuthenticationFailed;
}
public OAuth2Authenticator GetAuthenticator()
{
return _auth;
}
private void OnAuthenticationCompleted(object sender, AuthenticatorCompletedEventArgs e)
{
if (e.IsAuthenticated)
{
var token = new MyAccountOAuthToken
{
TokenType = e.Account.Properties["token_type"],
AccessToken = e.Account.Properties["access_token"]
};
_authenticationDelegate.OnAuthenticationCompleted(token);
}
else
{
_authenticationDelegate.OnAuthenticationCanceled();
}
}
private void OnAuthenticationFailed(object sender, AuthenticatorErrorEventArgs e)
{
_authenticationDelegate.OnAuthenticationFailed(e.Message, e.Exception);
}
Thanks in advance.