smgcknt-tech / traweather-react-app

1 stars 0 forks source link

Login function error #16

Closed smgcknt-tech closed 3 years ago

smgcknt-tech commented 3 years ago

Possible cause -SSL authentication implemented yesterday.

Confirmed information -After entering the login information,Apparently, the login function has been working, but after that, the JWT access token that should remain in the localStrage is not held, and the logout process runs immediately.So the cause is likely to be the API code around user authentication or the frontend code that receives the jWT.

smgcknt-tech commented 3 years ago

Although accessToken is returned from backend, auth processing fails and error 400 is displayed.

smgcknt-tech commented 3 years ago

Cause. AWS cloudfront was discarding the request headers from the client.

It was dealt with by the following method. -Created a whitelist in the cache policy of awscloudfront and enabled to allow custom header "access_token" to be sent to the origin server.

smgcknt-tech commented 3 years ago

ref  

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/add-origin-custom-headers.html#add-origin-custom-headers-forward-authorization

https://medium.com/@omkar.sonawane/amazon-cloudfront-http-request-headers-authorization-header-22393c624da9

https://dev.classmethod.jp/articles/how-do-i-enable-basic-authentication-behind-cloudfront/