Open thomaschristensen opened 1 year ago
Appears to be when username is shorter than 3 letters and this error does not end up in the returned message
Hi, you can validate the request body. Kindly read following tutorial: https://www.bezkoder.com/spring-boot-validate-request-body/
Getting 401 issue while calling singup api. any solutions can be suggested?
Getting 401 issue while calling singup api. any solutions can be suggested?
curl --location 'localhost:8080/api/auth/signup' \ --header 'Content-Type: application/json' \ --header 'Cookie: JSESSIONID=89CC086CF0D4CF7D8A3E542AFA8CDF54' \ --data-raw '{ "username":"phiauphiau", "email":"phiau@phiau.com", "password":"phiauphiau", "role":[] }'
Above curl request work fine. Below getting the 401 as you.
curl --location --request POST 'localhost:8080/api/auth/signup?username=phiauphiau&email=phiau%40phiau.com&password=phiauphiau&role=ROLE_USER' \ --header 'Cookie: JSESSIONID=89CC086CF0D4CF7D8A3E542AFA8CDF54'
Addon ValidationExceptionHandler Class. See in the article: https://www.bezkoder.com/spring-boot-validate-request-body/
@thomaschristensen got the solution?
No, but I haven't tried with newer versions
No, but I haven't tried with newer versions
on java java -version java version "17.0.1" 2021-10-19 LTS Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39) Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
nothing on console
***property spring.datasource.url=jdbc:mysql://localhost:3306/DB_1?useSSL=false spring.datasource.username=root spring.datasource.password=PASSWORD spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect spring.jpa.hibernate.ddl-auto=update bezkoder.app.jwtSecret= ======================BezKoder=Spring=========================== bezkoder.app.jwtExpirationMs=86400000
When trying to create users following the example in the docs I get 401 on posting to /api/auth/signup