Jan Martin
Jan Martin

Reputation: 309

Google Workspace add on attempting to authenticate as users personal account instead of work account

We have a situation where users are logged into both work and personal accounts and do not want to log out of their personal accounts to use our add on.

How can we force the ScriptApp.getOAuthToken() call to use the work account instead of the personal account?

Below you can see I am logged in as a work account on the icognition.cloud domain, yet the App Script attempts to authorize as my personal account.

enter image description here

Here is a way to reproduce the issue:

// call this from anywhere while logged in as two accounts, theres no way to tell it to retrieve a token for a particular account
ScriptApp.getOAuthToken();

Upvotes: 2

Views: 102

Answers (1)

Wicket
Wicket

Reputation: 38416

From the question

How can we force the ScriptApp.getOAuthToken() call to use the work account instead of the personal account?

Set the work account as the default account. To do this, users should sign out. Then, they should sign in using the work account first and then the personal account.

Upvotes: 0

Related Questions