Forum Libraries, Components, and Plugins

[X.Auth] Google unsupported_response_type

Hey guys,

I've been trying to authenticatie my users via Google using the Xamarin.Auth component. I'm keep recieving the following error: unsupported_response_type while using the following code:

var auth = new OAuth2Authenticator (
                clientId: "myId",
                scope: "email",
                authorizeUrl: new Uri ("https://accounts.google.com/o/oauth2/auth"),
                redirectUrl: new Uri ("http://localhost"));

What am I doing wrong here?

Thanks in advance!

Posts

  • MittchelMittchel USMember

    I've been trying the following.. which doesn't give me an error anymore, but unfortunately, it gives me a 'Could not connect to service' error from Xamarin.Auth. Also, my Username field is empty for some reason.

    var auth = new OAuth2Authenticator ( clientId: "idthing", clientSecret: "secretthing", scope: "email", authorizeUrl: new Uri ("https://accounts.google.com/o/oauth2/auth"), redirectUrl: new Uri ("http://localhost"), accessTokenUrl: new Uri ("https://accounts.google.com/o/oauth2/token"));

  • sezamuzsezamuz BSMember ✭✭

    The same problem. Up thread.

  • sezamuzsezamuz BSMember ✭✭

    solved:

            public void LoginToFacebook (bool allowCancel)
            {
                var auth = new OAuth2Authenticator (
                    clientId: "...",
                    scope: "",
                    authorizeUrl: new Uri ("https://m.facebook.com/dialog/oauth/"),
                    redirectUrl: new Uri ("http://www.facebook.com/connect/login_success.html")
                );
                Login (allowCancel, auth, AccountFacebookName);
            }
            //
            public void LoginToGoogle (bool allowCancel)
            {
                var auth = new OAuth2Authenticator (
                    clientId: "...-... .apps.googleusercontent.com",
                    clientSecret: ".-...",
                    scope: "openid",
                    authorizeUrl: new Uri ("https://accounts.google.com/o/oauth2/auth"),
                    redirectUrl: new Uri ("http://.../Account/ExternalLoginCallback"),
                    accessTokenUrl: new Uri ("https://accounts.google.com/o/oauth2/token"),
                    getUsernameAsync: null
                );
                Login (allowCancel, auth, AccountGoogleName);
            }
            //
            string accName;
    
            void Login (bool allowCancel, OAuth2Authenticator auth, string _accName)
            {
                auth.AllowCancel = allowCancel;
                accName = _accName;
                auth.Completed += LoginCompleted;
                PresentViewController (auth.GetUI (), true, null);
            }
            //
            void LoginCompleted (object sender, AuthenticatorCompletedEventArgs e)
            {
                DismissViewController (true, null);
                if (e.IsAuthenticated) {
                    accountStore.Save (e.Account, accName);
                } else {
                    // The user cancelled
                }
            }
    
  • GaryLeake.9751GaryLeake.9751 USUniversity ✭✭

    @sezamuz can you tell me what the ... is in your redirectUrl? Is is my domain or http://localhost or some other hidden google field?
    Thanks

  • SuchithSuchith INMember ✭✭✭

    @sezamuz : how did you add call back url for installed application.

Sign In or Register to comment.