A RESTful api jwt authentication service provider for fronend applications.
- Angular tirtharajsinha/angular-auth
- Next/React + Redux github.com/tirtharajsinha/NEXTjwtAuth
- also Can be used with any frameowrks.
- Angular
- React.js
- Next.js
- Nuxt.js
- vue.js
- vanila js etc...
pip install -r requirements.txt
JWT_SECRET="<JWT Secret key>"
SECRET_KEY="<Django Secret key>"
Generate Secret Key from here.
visit https://www.cryptool.org/en/cto/openssl and Run Command
openssl rand -bas64 32
python manage.py makamigrations
python manage.py migrate
python manage.py runserver
- /api/register [POST]
takes ->
{
username:string,
email:string,
password:string
}
return ->
{
id:int,
username:string,
email:string
}
- /api/login [POST]
takes ->
{
email:string,
password:string
}
return ->
{
jwt:string
},
cookies: jwt
- /api/logout [POST]
takes ->
{},
cookies:jwt
return ->
{
message:string
}
- /api/user [GET]
takes ->
{},
cookies:jwt
return ->
{
id:int,
username:string,
email:string
}