How can I check if users are logged in using the API in a smartphone application or single page application?
For example, in Laravel, we can use Auth::check() to check if the user is logged in.
How do I implement this in my API?
I would appreciate it if you could tell me.
Thank you very much.
sgo
June 23, 2021, 4:55pm
3
Hi @nnahito ,
The SPA SDKs have getTokenSilently
which performs a silent authentication in a hidden iframe to check if the user has a valid session. If they do, tokens will be returned, if they have been logged out, you will get a “Login required” error which would indicate the user no longer has a session with Auth0.
Mobile apps will typically make use of refresh tokens on the other hand to keep the user “logged in”:
Thank you for your answer.
I see that the SDK has something called getTokenSilently.
Is there any way to check this via the PHP API?
I will eventually create the app, but I want to run it in PHP first to see how it works.
For example, if I run the API in PHP, it will check if the user is logged in.
sgo
June 25, 2021, 2:34pm
5
I believe the closest equivalent in the PHP SDK is the getUser
method:
Auth0-PHP Readme
system
Closed
July 10, 2021, 2:35pm
6
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.