Reputation: 1
I got a warning message like this "JWT token does not begin with Bearer String" before I generate the token, and it's also more warning like this when I open swagger.
Upvotes: 0
Views: 7709
Reputation: 646
your have to provide the Bearer String,
must of the libraries out there provide and automatic way of doing that,
for example with io.jsonwebtoken
long now = (new Date()).getTime();
String token = Jwts.builder()
.setSubject("username")
.claim("roles", "ROLE_ADMIN, ROLE_USER")
.signWith(key, SignatureAlgorithm.HS512)
.setExpiration(new Date(now + 86400))
.compact();
here token starts with Bearer
Upvotes: 3