angular-17-jwt-auth icon indicating copy to clipboard operation
angular-17-jwt-auth copied to clipboard

HttpOnly not working

Open naviinbharathy opened this issue 1 year ago • 1 comments

I have followed your spring boot 3 and angular 17 JWT tutorial. Everything is working fine except JWT.

  1. I am able login, and refresh token is created
  2. I am able to see httpOnly cookie in my frontend response
  3. but for subsequent requests token is not being sent to backend
  4. backend it shows "AnonymousUser"

naviinbharathy avatar Mar 29 '24 12:03 naviinbharathy

Hi, before running the backend server, you need to add minor configuration:

/* In AuthController.java */
// @CrossOrigin(origins = "*", maxAge = 3600)
@CrossOrigin(origins = "http://localhost:8081", maxAge = 3600, allowCredentials="true")

/* In TestController.java */
// @CrossOrigin(origins = "*", maxAge = 3600)
@CrossOrigin(origins = "http://localhost:8081", maxAge = 3600, allowCredentials="true")

tienbku avatar Mar 29 '24 23:03 tienbku