Skip to main content

I am creating a custom integration using the Google Calendar API. I can get the oauth2 authentication to work initially, but it stops working after about an hour. I am trying to get a refresh token, but my guess is that something in that process is not working. 

 

I have setup these URL parameters:

response_type = code

approval_prompt = force (I’ve tried ‘consent’ but same results)

access_type = offline

 

How can I get my authorization to stick?

 

@reevesc - You should add set these query params in the authorization URL:

client_id: Your OAuth2 CLIENT_ID

state: “{{bundle.inputData.state}}”

redirect_uri: “{{bundle.inputData.redirect_uri}}”

response_type: “code”

prompt: “consent”

access_type: “offline”

 

This should allow you refresh the token without having to interact with the user.


Thank you for the reply. I was able to get this fixed.

 

In the end, I set up my Authorization URL parameters as you mentioned.

 

For my access token request I have:

code: {{bundle.inputData.code}}

client_id: {{process.en.CLIENT_ID}}

client_secret: {{process.env.CLIENT_SECRET}}

grant_type: authorization_code

redirect_uri: {{bundle.inputData.redirect_uri}}

 

And for Refresh Token Request

client_id (same as above)

client_secret (same as above)

grant_type: refresh_token

refresh_token: {{bundle.authData.refresh_token}}

 

It’s now working flawlessly!

This documentation helped:

https://developers.google.com/identity/protocols/oauth2/native-app#offline