2
votes

I have Google Assistant App with Account Linking enabled. I am getting error while linking account to the App using "Authorization code" flow.

I tested the Authorization code account linking flow via the oauthplayground (https://developers.google.com/oauthplayground). I am getting the Auth code and later used that to generate the access_token and refresh_token properly.

However, when i do the actual account linking using the assistant auth handoff url (https://assistant.google.com/services/auth/handoffs/auth/start?account_name={accountname}&provider={projectid}&scopes=openid+email+profile&return_url=https://www.google.com), i am getting linking error.

User Flow:
After the OAuth flow is initiated, user goes through login and then provides their consent. After the consent step is done, user is redirected back to the original redirect_uri with auth code and state value.

Ex: https://oauth-redirect.googleusercontent.com/r/{projectid}?code={auth code}&state={state value}

This page redirects the user to oauth completion page and passes both the state and code values properly.
Ex: https://assistant.google.com/services/auth/handoffs/auth/complete?state={state value}&code={auth code}

User is redirected to the below URL at the end of the auth flow : https://www.google.com/?result_code=FAILURE&result_message=Account+linking+failed

My Auth service provider is returning a valid code and state properly. My Token service is returning valid token information in exchange for the auth code. Here is the response:

{
  "access_token": "<access token>", 
  "token_type": "Bearer", 
  "expires_in": 120, 
  "refresh_token": "<refresh token>"
}

Any help is greatly appreciated.

1
Can you update your question to clarify (and remove sensitive information) what you're getting in the last stage of the account linking (the exchange leading up to the FAILURE code) and what you're returning?Prisoner
Thanks. I have updated the question to add the steps and user flow along with the request and response.Purusottam

1 Answers

1
votes

I think, it was a caching issue. It's working properly now.

At the end of the flow, user is getting redirected to google.com with success result code.

i.e.: https://www.google.com/?result_code=SUCCESS&result_message=Accounts+now+linked

I had all the steps in place since last 2 days and i have not updated anything in terms of code or configuration. It was not working earlier. But, now it's working properly.