How to check the auth0 Session using the Ruby SDK

Hi, I’m using the ruby SDK to authenticate users programmatically when users visit our websites.

My application is a server-side regular ruby on rails app.

Overall it works wonders, I’m able to redirect users using the client.authorization_url if I don’t have an access token stored in session.

Now, my use case is that my client has several applications where users can log in and out. So far if a user is logged in and I redirect to the auth0 login screen I get back a code which I exchange for tokens using client.exchange_auth_code_for_tokens. This is how I can then store the access token in the session.

If I go to any other of my apps auth0 detects that the user is already logged in and redirects to my callback URLs. Which is great.

The log-out functionality it’s where it’s getting tricky. Because if I log out in any of the apps, it logged me out of auth0 correctly but because I’m working with access tokens. If the access token is not expired I don’t have a way to check that the users have been logged out of auth0.

I’ve checked the PHP auth0 SDK and it has a $this->auth0->getCredentials(); which successfully checks for the auth0Session.

I’m looking either for the equivalent in the Ruby SDK or for any guidance.

Help will be definitely very appreciated!

@konrad.sopala I see you contribute to responses regarding the ruby sdk. Your help would be very appreciated if you could :pray: