Closed lanaarnous01 closed 2 years ago
log out and in again
but in postman it says could not send request Error: Invalid character in header content ["Authorization"]
I'm only guessing that you added the script that saves bearer token as env variable in postman upon login so that you don't have to set the headers every time. If this is the case just hit login route again from postman. It will update env variable when receives new token from server just like you overwrite your token in client.
Yes it will happen in production just as well and depends on your token expiration time you set on the server. I belive better user experience could be delivered having check on response and automatically log user out when 401 received. That would remove outdated token from local storage and prevent confusion.
i am not setting the header everytime but i just clicked on headers and i recieve an exclmination mark from autherization and when i logged in and out went back to postman for the loggin route and still says doestn send a request and error invalid
You should probably move this thread to udemy qna. It is hard to guess remotely. You should have an "Authorization" header with string value of format: "Bearer < token >" on every request that goes through your auth middleware. Try setting it by hand with latest token you got from server upon login.
how can i see the latest token from the server?
It comes in response body from login route after successful login.
Sorry, I am not following, where and how exactly?
Consider completing the course first. That will give you understanding of how your application works. It's possible there's no quick fix if you do not know the flow of the app.
This is the error i keep getting on postman
i just want to know from where can i get the new token
Token is generated on the backend by authUser controller. To get one from the client you have to send POST request to /login route with valid login and password in request body. You will find a token in response body.
I did the post login but still, the error keeps occurring
products collection is working but not the delete products by admin user and auth collection none of the routes are working
Please check your bearer token from jwt.io . @lanaarnous01
it says invalid signature
i copied and paste the bearer token in authorization postman and pasted it in jwt.io and says invalid signature
i removed the last character in my token still invalid signature, what can i do
You don't need that header for login, you are sending credentials in body. Remove that header, hit login and get new token from backend.
Please continue this in UDEMY
i tried removing it but it doesnt allow me its locked
in postman says cannot send request and i cannot delete products from the products list please help how can i refresh my token and if i deploy the app is this still going to happen? Thank you