0

Hi Im trying to use JWT in Spring boot

My code:

import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.Jwts;
@RestController
public class UserController {

    @PostMapping("user")
    public User login(@RequestParam("user") String username, @RequestParam("password") String pwd) {

        String token = getJWTToken(username);
        User user = new User();
        user.setUsername(username);
        user.setToken(token);
        return user;

    }

and i added on dependencies: enter image description here

But when i tried to run: enter image description here

Show an error

2 Answers 2

1

for me worked just this way

<dependency>
        <groupId>io.jsonwebtoken</groupId>
        <artifactId>jjwt</artifactId>
        <version>0.9.1</version>
    </dependency>

without specifying compile or whatever time

Sign up to request clarification or add additional context in comments.

Comments

0

Try rebuilding the project using

Select Build->Rebuild Project

might solve the issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.