Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
77 views
in Technique[技术] by (71.8m points)

Specify log-in in GMail URL

Part of an app I'm working on creates links to messages in GMail using their message ID:

"https://mail.google.com/mail/u/0/#search/" + encodeURIComponent(`rfc822msgid:${interaction.messageId.replace(/(^<|>$)/g, "")}`)

Simple enough.

The problem comes when a user has multiple Google accounts, and the message they're opening does not belong to the currently logged in one: The link should open a search with only one result, if the user isn't logged in to the correct account, no message is displayed.

Is there any way to specify which email address to open the message with in the URL?

Something along the lines of https://mail.google.com/mail/u/0/[email protected]#search/rfc822msgid:[email protected]

question from:https://stackoverflow.com/questions/65941018/specify-log-in-in-gmail-url

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Found an answer over on WebApps.

You can use the query string parameter authuser to specify an account to use with the URL:

https://mail.google.com/mail/u/[email protected]

or (using the URL from my question):

https://mail.google.com/mail/u/0/[email protected]#search/rfc822msgid:[email protected]


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...