Closed
Description
Hi everyone,
I am trying to authenticate my app to make REST calls to Google from Unity. I successfully generate an authCode
from logging in with this API with the following configuration.
configuration = new GoogleSignInConfiguration {
WebClientId = webClientId,
UseGameSignIn = false,
RequestIdToken = true,
RequestAuthCode = true,
AdditionalScopes = scopes
};
I'm now trying to exchange my authCode
for an accessToken
so I can make REST calls to different APIs. I referenced #57 and my code for this is below.
WWWForm formData = new WWWForm();
formData.AddField("client_id", webClientId);
formData.AddField("client_secret", webClientSecret);
formData.AddField("grant_type", "authorization_code");
formData.AddField("code", "AuthCode");
UnityWebRequest www = UnityWebRequest.Post("https://www.googleapis.com/oauth2/v4/token", formData);
I get a 400 Generic/unknown HTTP error
with the response { "error": "invalid_grant", "error_description": "Malformed auth code." }
. What is going wrong? Am I able to use a webClientID
to access Google API from REST? Is there a problem with authCode
generation? Please advise, thanks.
Metadata
Metadata
Assignees
Labels
No labels