Reputation: 75
I´m following this Google documentation to make account linking with oauth. In the token exchange requests item, I am receiving the JSON below, as expected:
{
"client_id" : "*****",
"client_secret" : "*****",
"code" : "myauthorization_code",
"grant_type" : "authorization_code",
"redirect_uri" : "https://oauth-redirect.googleusercontent.com/r/****"
}
and my response is:
{
"access_token" : "myaccess_token",
"expires_in" : 3600,
"refresh_token" : "myrefresh_token",
"token_type" : "Bearer"
}
But I am getting "Something went wrong, please try again later"`error, in Google assistant app in iOS. In stackdriver, I am getting the error:
SYNC: Request ID 4417600193631747637 failed with code: OPEN_AUTH_FAILURE
Upvotes: 0
Views: 319
Reputation: 63293
Based on your example, it sounds like you are skipping a step. The account linking process has two steps:
It looks like you responded to the authorization request directly by providing a token. The authorization request should return a unique temporary code representing the user who authorized, which will be passed back to your token exchange endpoint to get the access token.
You can read more about how to implement account linking with your OAuth server in the documentation.
Testing Account Linking
You can use the Google OAuth Playground to verify that your account linking implementation is working properly. Here is how you can configure this tool to test your endpoint:
You won't be authorizing any Google APIs, so for Step 1 you can just enter something like "devices" and click Authorize APIs. You can follow through with the flow in Step 2 to verify that the authorization and token exchange work properly. The tool will report if any errors occur in the flow.
Upvotes: 1