slim-jwt-auth icon indicating copy to clipboard operation
slim-jwt-auth copied to clipboard

How to tackle with 2 authorization cookies

Open gohelkiran30 opened this issue 2 years ago • 2 comments

Is there any way to handle tokens from 2 different token values? Any one is present at a time. This is required for session cookies for different type of user.

For example, buyer login has a cookie with name buyer-token and seller login has a cookie with name seller-token.

If any one cookie is present than user should be authenticated.

Anyway to achieve this?

gohelkiran30 avatar Aug 25 '22 12:08 gohelkiran30

My thoughts are that probably isn't the best way to approach your problem. I think that using a single token, specifying a role (or roles) in that would be more correct.

wallacio avatar Aug 25 '22 14:08 wallacio

You could create another middleware which looks for the two cookies and if one is found renames it to token and configure this middleware to look for cookie named token.

tuupola avatar Aug 26 '22 11:08 tuupola