This endpoint allows a user's credentials to be validated.
Function checks if user's token exists:
Two different endpoints, /protected requires a token, as can be seen with @token_required
Earlier version #2
This one successfully returned a token, but I changed to the first method because I wanted to use a different method. After coding the first method, I found that these two versions would produce the same result.
Technicals: Implementing JWT to identify users
Current version:
Backend:
Configuring JWT settings:
Configuring an endpoint to return a token:
Frontend:
Sending a fetch request to obtain the token:
Token successfully added:
Earlier versions
This endpoint allows a user's credentials to be validated.
Function checks if user's token exists:
Two different endpoints,
/protected
requires a token, as can be seen with@token_required
Earlier version #2
This one successfully returned a token, but I changed to the first method because I wanted to use a different method. After coding the first method, I found that these two versions would produce the same result.