lwu1822 / fastpages

Blog
Apache License 2.0
0 stars 2 forks source link

Project Check #6 #49

Open lwu1822 opened 1 year ago

lwu1822 commented 1 year ago

Technicals: Implementing JWT to identify users

Current version:

Backend:

Configuring JWT settings:

image

Configuring an endpoint to return a token:

image

Frontend:

Sending a fetch request to obtain the token:

image image

Token successfully added:

image

Earlier versions

This endpoint allows a user's credentials to be validated.

image

Function checks if user's token exists:

image

Two different endpoints, /protected requires a token, as can be seen with @token_required

image

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.

image