Table of Contents
ReactApp.mp4
The main idea of creating this project is to create JWT Authentication system using .Net Core and React technologies.
- When the application is run, the client makes a request to the server with email and password information. If the email and password information is correct, access token and refresh token are returned to the client.
- It makes a request to an enpoint that is authorized on the server along with the client access token. If the access token is correct, the information is responded to the client.
- In case the access token expires, the client makes a request to the server with a refresh token and the server returns a new access token in return.
Technologies needed to get the project up and running
Follow the steps below to run the project in your local
-
Clone the repo
git clone https://github.com/muhammetcagatay/jwt-authentication.git
-
Create SQL Server Docker container
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=password123*" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest
-
Go to project folder
cd jwt-authentication/api
-
Restore and run api
dotnet restore dotnet run
-
Open new terminal and install npm packages
cd client npm install
-
Run Client
npm start
Listening and serving API Gateway HTTPS on : 5001
Method | URL | Description |
---|---|---|
POST |
/api/auth/login |
Returns of Access Token and Refresh Token |
POST |
/api/auth/refreshToken |
Returns of new Access Token and Refresh Token |
GET - Authorize |
/api/home |
Returns the "Giriş Başarılı" message |