loopback icon indicating copy to clipboard operation
loopback copied to clipboard

Orphan Tokens

Open masalinas opened this issue 9 years ago • 6 comments

Description/Steps to reproduce

How manage orphan tokens in Loopback. Actually I used mysql or mongodb. Anyway the problem is the same, when for example a user login correclty loopback create a register inside AccessToken Table or Collection, if the user just logged click refresh in the brower the token is orphaned, so the register remain continously in the databse, so my question is: how I must to manage this situation?, how I can avoid this situation and remove this register if the client session is closed??

Regards

Expected result

Maintain the tokens registered in the database syncronized all the time.

Additional information

masalinas avatar Jul 12 '17 11:07 masalinas

@ masalinas -- Will you please focus on one small issue/step (the immediate blocker) turning your question to a form of when I did A, B occurred as steps to reproduceand but, I expect C as expected result?

If the same occurs with mysql and mongodb, then focus on mysql and mention it in additional information Thanks!

Setogit avatar Jul 12 '17 17:07 Setogit

Of course the example is simple:

STEP01: Somebody for example X is registered corretly under our solution. I have a custom user called Customer inherited from loopback model User . I addes some atributes like: phone, status active.

STEP02: the same user called X login correctly in our application. Loopback authorized the user, and create for him a access token register in our database (MongoDB) in the collection called AccessToken with the token Id, customerId, creation date and TTL.

STEP03: If the user click the refresh button of the browser we go to the login view again so the token will be orphaned in the database and my question is how can i manage this situation?

I hope explain the problem

Regards.

masalinas avatar Jul 13 '17 07:07 masalinas

@masalinas -- Based on the information: Does the app recreate the token when the user logged in again after the STEP03 and the user can continue the operation? What issue in LoopBack do you see there? Would that be a potential bug in LoopBack or a new feature request? Thanks!

Setogit avatar Jul 13 '17 16:07 Setogit

I always recreate the roken I never reuse it. So if the token is orphaned will continue forever. I would like to know how we can resolve this problem or what if the pattern to resolve this situation.

masalinas avatar Jul 17 '17 13:07 masalinas

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 15 '17 13:09 stale[bot]

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

stale[bot] avatar Sep 29 '17 14:09 stale[bot]