xamarin / Xamarin.Auth

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

Instagram Login: I am getting Invalid scope field(s) exception Xamarin.Forms using Xamarin.Auth, how to fix? #449

Open divyesh008 opened 3 years ago

divyesh008 commented 3 years ago

Xamarin.Auth Issue

Invalid scope field(s) exception in Android

var authenticator = new OAuth2Authenticator(
    clientId: Keys.InstagramClientId,  
    scope: "basic",  
    authorizeUrl: new Uri("https://api.instagram.com/oauth/authorize/?client_id=" + Keys.InstagramClientId + "&redirect_uri=https://localhost:3000/callback&response_type=token"),
    redirectUrl: new Uri("https://localhost:3000/callback"))
{
    AllowCancel = true,
    ShowErrors = false,
    ClearCookiesBeforeLogin = true
};

AuthenticationState.Authenticator = authenticator;

authenticator.Error += (sender, eventArgs) =>
{
    activity.Finish();
};

authenticator.Completed += (sender, eventArgs) =>
{
    if (eventArgs.IsAuthenticated)
    {
        App.AccountType = "Instagram";
        App.SaveAccount(eventArgs.Account, view.IsFromReauthentication);
    }
};

var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
presenter.Login(authenticator);

Steps to reproduce

  1. Try to login with instagram
  2. It will show this exception

Platform:

Expected behaviour

Login successfully and redirect back to application

Tell us what should happen

Actual behaviour

Getting Invalid scope field(s) exception

Tell us what happens instead Can you also include a screen shot?

Insta_Exception