2

When you use the Google Drive web client you can the first time choose which Google account you want to connect to. Once you have done that subsequent calls skip the step where you can choose an account - you don't have to authorize again. Is there any way to trigger the account selection again without actually logging out from your Google account?

I'm using the file picker API, see https://developers.google.com/picker/docs/

hjhlarsen
  • 147
  • 9
  • Is this issue similar to this (forcing the account selection)? http://stackoverflow.com/questions/14384354/force-google-account-chooser – adjuremods Jan 13 '16 at 00:50
  • I just updated the description saying that I'm using the Google file picker API. Based on your comment I did try changing the authorization call to the following: function onAuthApiLoad() { window.gapi.auth.authorize( { 'client_id': clientId, 'scope': scope, 'prompt': 'select_account' }, handleAuthResult); } This call was accepted (with 'prompt': 'select_account'), but it didn't change anything, once you're logged in you're not prompted again. – hjhlarsen Jan 13 '16 at 23:33

1 Answers1

2

After reading the issue Is it possible to be able to correctly select any available Google account to use when using authorisation via the JS client library for Drive? I found that the following authorization call achieve what I wanted:

function onAuthApiLoad() {
    window.gapi.auth.authorize({
            'client_id': clientId,
            'scope': scope,
            prompt: 'select_account',
            authuser: -1
        },
        handleAuthResult);
}

The authuser argument specifies which of multiple accounts should be selected automatically, defaulting to 0. When adding

            prompt: 'select_account',
            authuser: -1

none of the accounts is automatically selected, so the user is prompted again.

Community
  • 1
  • 1
hjhlarsen
  • 147
  • 9
  • You don't need the prompt: 'select_account'. Just the authuser: -1 will give you the expected results also. – Paul Lemke Sep 06 '16 at 14:35