Reputation: 305
I have a project user java spring boot and oauth2. Access token is very too long.
How to set length of access token. Thanks for help
Upvotes: 0
Views: 2508
Reputation: 6581
I assume you're using mostly default configuration and therefore the DefaultTokenServices builds your access token.
Since spring is completely open source you can look easily into their code and find this line:
DefaultOAuth2AccessToken token = new DefaultOAuth2AccessToken(UUID.randomUUID().toString());
There is no option to specify the length of your access token. An option would be to implement a token service by yourself and create an access token in a way you want to.
There is already another question that asks how to create a custom oauth2 token. Maybe this helps you doing this.
But be careful when implementing this by yourself, because this is in fact your security token. If it is weak, your authentication is weak.
Upvotes: 1