Is it possible to detect if a user is currently signed in, given a specific e-mail account?

142 Views Asked by At

Use Case: I would like to be able to activate a link only if the user is logged-in to their e-mail provider.

Conditions: The easiest way would be to require the user to authenticate before they can access the link. This will ensure that they logged in. But, I do not want to present the user with an explicit sign-in modal. They should just be able to click on the link and access the content if they are already logged in else denied access.

Analysis: I noticed there are ways to detect if a user is logged into any google account. - Detect if a web user is currently logged in Google? . However, I was wondering if it is possible to be able to pass an e-mail id and detect if they are logged in their service provider.

Any thoughts or suggestions would be appreciated. Thanks!

1

There are 1 best solutions below

0
On

This is a slightly different approach but you could just set your application to authenticate the user with OpenIDConnect using Google. If they are already logged in to Google when the launch your application, they will be automatically authenticated. If they click on the link when they aren't logged in they will be prompted to login.

Implementation details can be found at https://developers.google.com/identity/protocols/OpenIDConnect