Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implemented Spring OAuth2, getting same access token from different devices

Implemented Spring OAuth2 security and getting same access token when logging with the same user but from different device. When i logout from any one of these devices(revoke Token)other devices are also getting logged out. Is it a expected behavior or i am missing something ? hoping that sharing the massive code will not help much so kept the question short and simple.

like image 991
Soumyaansh Avatar asked Dec 19 '22 00:12

Soumyaansh


1 Answers

The default behaviour of the DefaultTokenServices is to re-use existing tokens (based on the behaviour of the existing TokenStore implementations)

http://forum.spring.io/forum/spring-projects/security/oauth/121797-multiple-valid-oauth-access-tokens-for-same-client

If you want every device to be given different access_token then create your own AuthenticationKeyGenerator e.g. send your device id on authorization process and let your AuthenticationKeyGenerator process that device id to create access_token specific for that device.

like image 157
KSTN Avatar answered Dec 28 '22 06:12

KSTN