Skip to content
Advertisement

Google Calendar API – Refresh Token – refresh token must be passed in or set as part of setAccessToken

I am reading calendar events successfully, but when the access token expires, I cannot refresh it. Up until now, I have been getting a new access token but this doesn’t seem correct. I would rather refresh it properly.

I receive this error :

refresh token must be passed in or set as part of setAccessToken

From events.php

JavaScript

oauthcallback.php

JavaScript

Advertisement

Answer

fetchAccessTokenWithRefreshToken should work assuming that the refresh token you are sending it is in fact a refresh token and not null or something. I would try and print it out so that you can see its actually a value.

Here is my code.

oauth2callback.php

JavaScript

Oauth2Authentication.php

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement