Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force google to show account chooser and consent screen

I am able to use both prompt=consent and prompt=select_account individually, but Google doesn't seem to allow me to combine them. I tried the prompt=consent+select_account as suggested in an answer of Force google account chooser, but that fails with the error: "Invalid prompt: consent+select_account".

The doc (https://developers.google.com/accounts/docs/OAuth2Login) says "A space-delimited list", so I tried consent select_account but that fails with: "The requested URL was not found on this server."

I also tried combining prompt=select_account and approval_prompt=force, but Google doesn't like that either.

Anyone else have luck with combining consent screen and account chooser?

Update:

This is my JavaScript method creating URL for getting contacts from gmail

$scope.importGmailContacts = function() {
    provider = 'gmail';
    $scope.importing_from_gmail = true;
    window.open(protocol + "://" + host + ":" + port + "/contacts/gmail", "_blank",
     "toolbar=yes, scrollbars=yes, resizable=yes, top=0, left=0, width=600, height=600, prompt='select_account+consent', approval_prompt=force");
}

I have tried setting prompt and approval_prompt both collectively and individually but it does not seems to work. Refer to this question.

like image 505
user3591271 Avatar asked May 02 '14 20:05

user3591271


2 Answers

You need add: access_type=online&prompt=select_account+consent:

private static final String AUTHORIZE_URL 
    = "https://accounts.google.com/o/oauth2/auth?"
      + "response_type=code&access_type=online&prompt=select_account+consent"
      + "&client_id=xxx&redirect_uri=xxx";

private static final String SCOPED_AUTHORIZE_URL = AUTHORIZE_URL + "&scope=xxx";

..

like image 63
searching9x Avatar answered Oct 06 '22 20:10

searching9x


I just tried this and it DID work when space-delimited:

options[:prompt] = 'select_account consent'

like image 37
Brett C Avatar answered Oct 06 '22 19:10

Brett C