https://github.com/amkreta/jwtauthentication
https://github.com/amkreta/jwtauthentication
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/amkreta/jwtauthentication
- Owner: AmKreta
- Created: 2020-12-30T07:00:30.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-17T05:17:30.000Z (almost 3 years ago)
- Last Synced: 2025-01-18T04:41:38.777Z (5 months ago)
- Language: JavaScript
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
jwtAuthentication
url:-https://jwtauthentication.herokuapp.com
help url:- https://jwtauthentication.herokuapp.com/help
Routes:-
|Method |Route | req.body |response|
|------|------|------|------|
|GET |/genTokens?userId=${mongoDb object Id} | null |{accessToken, refreshToken}|
|POST |/verifyTokens | {userId, accessToken} |{sucess:true/failed, message:'jwt verifies/err', payload}|
|DELETE |/deleteTokens |{userId, accessToken} |{sucess:true/failed, message:'token deleted/err', payload}|
|PUT |/genNewTokens |{userId, accessToken, RefreshToken} |{sucess:true/failed, message:'generated new tokens/err', payload}|/### instructions:-
- The api only works for unique mongoDB.Schema.Types.ObjectID.
- request for new tokens will fail if old access tokens are still valid or refresh token is invalid or the access token sent is not the last one which was issued.
- request for verification and deletion will fail if proper userid and access tokens are not sent in req.body/### send request in followinf fashion:-
- generate new tokens when user logs in
- verify tokens for every request
- if verification fails generate new tokens and verify again
- delete tokens when user logs out