Is there an endpoint to check if a user is logged in


(Jay Pfaffman) #1

I need a URL that will return 200 for a logged in user and 401 or 403 if the user is not logged in.

If require_login is checked, every page does a 301 to the login page.


(Dean Taylor) #2

Is this a user request, i.e. using the current users session?

Or…

Is this an admin API request using an admin API key?


(Jay Pfaffman) #3

Yeah. It’s me not understanding the question I’m asking.

I’m trying to do an auth_request in NGINX to tell whether the request is coming from a user that’s logged in by querying an URL to see whether it gets a 200 response or not.

It’s occurring to me that doing that is not quite as simple as I’d hoped.


(Dean Taylor) #4

You could try /session/current.json

It will return 200 if authenticated and 404 if not.

Generally .json / API requests don’t redirect.


(Jay Pfaffman) #5

That seems promising. I’ll keep poking at it.

Many thanks!