Skip to content

iOS AuthCode return void #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alexmaroldi opened this issue Oct 11, 2018 · 7 comments
Open

iOS AuthCode return void #66

alexmaroldi opened this issue Oct 11, 2018 · 7 comments

Comments

@alexmaroldi
Copy link

Hi,
I have found this issue on iOS: after the first SignIn call, where I correctly retrieve the AuthCode after task completion, other calls to SignIn (or SignInSilently) always return empty string for task.Result.AuthCode

@mckoupel
Copy link

The same problem for me. Any ideas?
I'm trying to get access token using auth code but auth code is empty(

@alexmaroldi
Copy link
Author

@mckoupel sadly it seems correct for Google policy on iOS.
I solved by getting AccessToken after the first AuthCode and use that for login with server. I don't know if this could help you.

@mckoupel
Copy link

mckoupel commented Oct 26, 2018

Ok.
How you get access token using AuthCode? If I use something like this

 IEnumerator GetAccessToken(string authcode)
{
        WWWForm form = new WWWForm();
        form.AddField("client_id", webclientid);
        form.AddField("client_secret", "");
        form.AddField("grant_type", "authorization_code");
        form.AddField("code", authcode);

        UnityWebRequest www = UnityWebRequest.Post("https://www.googleapis.com/oauth2/v4/token", form);
        yield return www.SendWebRequest();

        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
        }
        else
        {
			
	 //Access token response
          Debug.Log(www.downloadHandler.text);

     }
 }

I always have 401 unauthorized...
Maybe something wrong with authcode lifetime?

@mckoupel
Copy link

And one more question. Is any way to reset authcode? After sign out I still have empty string in authcode. Sometimes authode not empty but I can't understand dependence. Maybe authcode lifecycle don't depend on sign out...Or something else wrong

@novavision
Copy link

Same here.. only 1st time I get AuthCode, and all other sign in attempts return empty field. Tried to remove app and reinstall - all the same.

@thsbrown
Copy link

thsbrown commented Aug 6, 2019

Also having this issue. I thought ForceTokenRefresh = true could solve the issue as it looks like that would force consent, but it's not looking like it's working.

@thsbrown
Copy link

thsbrown commented Aug 6, 2019

This stackoverflow post seems to be relevant here https://stackoverflow.com/questions/42434887/google-sign-in-server-auth-code-nil-ios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants