firebase / firebase-admin-go

Firebase Admin Go SDK
Apache License 2.0
1.12k stars 239 forks source link

How to revoke a session old when to do new login? #513

Closed renanbastos93 closed 1 year ago

renanbastos93 commented 1 year ago

How can I get sessions of a specific user and, in some way, be able to revoke any of these sessions? I'm trying to do that because I need to keep just two sessions alive per user. My goal is to revoke the oldest session if the user starts a new one.

I am so sorry my English is not so good. Case you don't understand I will try to explain again.

google-oss-bot commented 1 year ago

I found a few problems with this issue:

lahirumaramba commented 1 year ago

Hi @renanbastos93 are you looking a way to do this on server side using Firebase Admin SDK?

renanbastos93 commented 1 year ago

@lahirumaramba Hi!

Yeah, but I don't want to use other services like Redis, SQL, etc. I would like to use only the firebase/GCP identity.

see ya

lahirumaramba commented 1 year ago

You can't logout a user remotely via the Admin SDK, if that's what you are trying to solve. The logout should happen from the client side. See more about Managing User Sessions on: https://firebase.google.com/docs/auth/admin/manage-sessions

There is also a similar question on SO: https://stackoverflow.com/questions/53087895/how-to-force-logout-firebase-auth-user-from-app-remotely

In the future, please use StackOverflow for usage questions. Thank you!

renanbastos93 commented 1 year ago

@lahirumaramba thanks a lot for helping me.

FYI: @brenoandrade @PatrickChagastavares @akmissawa @helciofrancotc