This question seems to be asking almost the same thing, but for some reason I can't get any of the answers to fully work in my situation.

I'm looking for a direct link I can put in a web app to navigate to the inbox of a specific gmail account, with the following use cases:

  1. I would like a link to go to admin@domain.com (domain.com is a google workspace account).

  2. If a user is logged into user1@gmail.com and NOT into admin@domain.com, I'd like to go to the account login page for admin@domain.com

  3. If the user is not logged in to any gmail services (such as incognito), I'd like the link to go to the account login page for admin@domain.com (this is similar to 2, but google treats these differently)

  4. If a user is logged into admin@domain.com, I'd like them to go to the inbox directly.

I tried all the answers on the linked question, but I found they all failed case 2 for me. They would invariably simply go to my first logged in inbox (user1@gmail.com) in my example.

I got further with this answer by setting the passive=false parameter, but while this did show me the login screen for case 2, it autofilled the information with user1@gmail.com.

Is there a way to create a link that would follow these use cases for a gmail inbox? Or at least, is there a link that would simply bring me to the login page for admin@domain.com from all possible starting points?

The webapp will also probably use the gmail api, so if it's possible with that, that would also work as a solution (I haven't had a deep dive into it, but I didn't see anything off the top that would give me a link through the api)

1 Answer 1


Ended up finding an SO question and combining this with the answer I linked in the question to get the following URL which satisfies the conditions (note that ServiceLogin has changed to AccountChooser).


  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Nov 4, 2021 at 4:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.