majusko / grpc-jwt-spring-boot-starter

Spring boot starter for gRPC framework with JWT authorization
Other
39 stars 7 forks source link

IllegalStateException: Authentication schemeBearer {jwtTokenHere} not supported #139

Closed mateusscheper closed 2 years ago

mateusscheper commented 2 years ago

Hi!

I'm trying to secure my gRPC server with JWT but I can't make it work. I already set the token generation but I can't make it validate my token since it always gives me "Authentication scheme Bearer {jwtCodeHere} not supported".

If I put a breakpoint inside AuthenticationSchemeService.class at like 24, I can see it's trying to validate my token as Basic instead of Bearer.

Repository with demo: https://github.com/mateusscheper/java-grpc-demo

How to test:

What am I doing wrong? Thank you!

mateusscheper commented 2 years ago

Just saw that in GrpcSecurityConfiguration.class, line 59, it says that the bearer token selector will be used if we have this guy: https://mvnrepository.com/artifact/org.springframework.security/spring-security-oauth2-resource-server. After putting it in my pom.xml, everything worked as expected.