InfoCommons / cic

Apache License 2.0
0 stars 0 forks source link

Can tokens be refreshed? #113

Closed ryscher closed 1 year ago

sg3847 commented 1 year ago

@ryscher Yes, the OAuth 2.0 access token can be refreshed using a refresh token. Refresh Token can allow you to get a new access token without the user's interaction. When you make a request to get a new access token, the response includes a "refresh token". This refresh token is used to get a new access token without any user interaction.

Check out this script: https://github.com/columbia-it/covid-infocommons/blob/refresh_token/backend/apis/refresh_token.py You can run this script to get a new access token using your current (valid) refresh token. In order to run this script, you just have to add your current/valid refresh token to the creds.json file in the same path. After the script runs, the creds.json file will include a valid access token. You can have your other scripts read the access token from this creds.json file.