How to check if user is logged in from javascript?

Is there any option to make simple javascript request from browser to get information if user is logged in? Something linke monitoring: ?


The /userInfo endpoint returns info about a user by access_token, e.g. if an access_token is expired, you’ll get the following result:

    "error": "invalid_token",
    "error_description": "Access token expired: 05506490-ed46-4267-bc5e-e0cf84fcee4f"

If you need some custom logic, like an endpoint that returns true/false by given login, you need to implement a custom RestController. See docs for more information: Creating Custom OAuth2 Protected Controllers. Also, UserSessionService and UserSessionSource may be useful.


1 Like