fttx / barcode-to-pc-server

Barcode to PC server
https://barcodetopc.com/
GNU General Public License v3.0
207 stars 85 forks source link

Force the OAuth prompt when authenticating the GOOGLE_SHEETS for the first time #394

Open fttx opened 2 years ago

fttx commented 2 years ago

The refres_token is retrieved only the first time the app is approved in the google account. If the user has approved the app on multiple computers, the second computer won't receive the refres_token (I guess).

Solution:

Conditionally add prompt: 'consent' to const authorizeUrl = oAuth2Client.generateAuthUrl({ access_type: 'offline', scope: GSheetHandler.scopes, }); when the local client hasn't ever been authenticated