I want to know how to check if users are logged in

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.

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.

I believe the closest equivalent in the PHP SDK is the getUser method:

Auth0-PHP Readme

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.