Losing access to Google Drive - "refresh token must be passed in or set as part of setAccessToken"
I've had a few emails from Astiga and Google Drive users in the past week or two pointing to continued lost connections to Google Drive, with the following error message:
refresh token must be passed in or set as part of setAccessToken
TL;DR
Revoke access in Google Drive for Astiga, then edit the storage in Astiga, re-request the token and save it.
Longer explanation
When you grant access to Google Drive to Astiga, we receive a "token" which we use to prove we've been given access. This token has a lifespan of one hour. When you first request the token we also get a "refresh token" which we can use to re-request the token and keep things working.
However, if you ever re-request a token, the new token does not have the refresh token inside it. Currently, the edit storage page requires a token to be entered, but it's unpopulated, which means you might want to click the _Get code_ button to get a new token. If you do this, and copy/paste the token back into Astiga's "edit storage" page, and save it (as I advised you to do) this means the refresh token is lost, and access runs out after the default one hour.
Workaround
You must revoke permissions in Google Drive for Astiga and re-request the token.
- Go to https://myaccount.google.com/u/0/permissions.
- Click Astiga.
- Click "REMOVE ACCESS" and confirm.
Now you can re-request the token. This new token should have the refresh_token
:
- Go to https://play.asti.ga/settings
- Click the Google Drive storage account affected.
- Click "Get token".
- Authorise in Google Drive, then copy the resulting token back into the settings page.
- Click "Save storage".
Longer term
The issue here is that the edit storage page requires the token, which encourages you to click _Get code_ but this new code does not have the refresh token so access gets cut off after a following hour.
We will fix the edit storage page so the existing token is pre-populated.
Comments
This should now be deployed: https://community.asti.ga/discussion/comment/2609/#Comment_2609