bezkoder / spring-boot-spring-security-jwt-authentication

Spring Boot + Security: Token Based Authentication example with JWT, Authorization, Spring Data & MySQL
1.29k stars 815 forks source link

Role is not found #12

Open Rajveer9575 opened 3 years ago

Rajveer9575 commented 3 years ago

com.bezkoder.springjwt.controllers.AuthController.lambda$1(AuthController.java:99)

arifdemircan commented 2 years ago

I have the same Issue??

arifdemircan commented 2 years ago

Please let me know if you have a Solution?

arifdemircan commented 2 years ago

Thank you for you advances :)

ramazansakin commented 1 year ago

@Rajveer9575 @arifdemircan you can check my updated repo, I solved some problems including "Role not found" and also I dockerized the all app and refactored.

https://github.com/ramazansakin/spring-boot-spring-security-jwt-authentication

v1shaL-b commented 1 year ago

I am having an issue. When registering all users are getting assigned ROLE_USER no matter what I use. I am using Postman to test API.

ramazansakin commented 1 year ago

Hi @v1shaL-b , You can try to sign up with body like : { "username" : "rmzn", "email" : "rmzn@mail.com", "password" : "1234567", "roles" : [ "admin" ] }

After succesfully registration then sign in ll be returned like: { "token": "eyJhbGciOiJIUzUxMiJxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "type": "Bearer", "id": 1, "username": "rmzn", "email": "rmzn@mail.com", "roles": [ "ROLE_ADMIN" ] }

It's an admin user, you can check it on TestController. If you have a problem on this repo, you can check mine : https://github.com/ramazansakin/spring-boot-spring-security-jwt-authentication