xamarin / Xamarin.Auth

Xamarin.Auth
Apache License 2.0
542 stars 350 forks source link

The token used in the request has been revoked by the user #461

Open differenz-Team opened 2 years ago

differenz-Team commented 2 years ago

Xamarin.Auth Issue

I have implemented LinkedIn login using OAuth2Authenticator in Xamarin. But for the last few days, it is not working on the Andriod device.

I am got the error "service Error Code":65601,"message":"The token used in the request has been revoked by the user" while I try to LinkedIn from an Android device.

Here, is the code where I got the error access token revoked by the user. IF BUG, INCLUDE THIS PART:

nuget version = Xamarin.Auth (1.7.0)

Steps to reproduce

  1. I call this on LinkedIn login button click. var auth = new OAuth2Authenticator( clientId: Keys.LinkedInClientId, clientSecret: Keys.LinkedInClientSecret, scope: ConfigService.Environment.LinkedInScope, authorizeUrl: new Uri("https://www.linkedin.com/oauth/v2/authorization"), redirectUrl: new Uri(ConfigService.Environment.LinkedInRedirectUrl), accessTokenUrl: new Uri("https://www.linkedin.com/oauth/v2/accessToken")) { AllowCancel = true, ShowErrors = false, ClearCookiesBeforeLogin = true, IsLoadableRedirectUri = false };

  2. Then I have allow to LinkedIn login access auth.Completed += (sender, eventArgs) => { // We presented the UI, so it's up to us to dismiss it on iOS. if (eventArgs.IsAuthenticated) { auth.ShowErrors = false; Constants.AccountType = "LinkedIn"; GlobalLogic.SaveAccount(eventArgs.Account, view.IsFromReauthentication); } else { // The user canceled } };

  3. And I am getting eventArgs.IsAuthenticated = true and also getting AccessToken and ExpiredTime in eventArgs.Account.

  4. But I tried to get LinkedIn profile details from https://api.linkedin.com/v2/me LinkedIn API. That time I have faced the error "The token used in the request has been revoked by the user" in response.

I need a refresh token for getting LinkedIn profile details(Email Id, Profile picture, Name). Where do I get refresh token and how?

Thanks in advance.

mannawar commented 1 year ago

Did you included offline_acsess scope in your auth request?