-
Notifications
You must be signed in to change notification settings - Fork 4
Third party Auth API
Saravanakumar Nagaraj edited this page Jun 11, 2021
·
1 revision
Login URL /api/auth/google
- open the URL in the same window
- select the account
GET /api/auth/current_user
Success : (Status code - 200)
{
"error":false,
"message":"user has been successfully authenticated",
"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ",
"user":{
"_id":"4038g8986ac64fce3ac17a0a",
"name":"masai",
"email":"masai@gmail.com",
"role":"user",
"profilePic":"https://lh3.googleusercontent.com/a-/AOh14GjiTkKxyNG10NjIhfuUsTJcRIne0j33RFWUZV1C=s96-c",
}
}
Error : (Status code - 401)
{
"authenticated":false,
"error":true,
"message": "user has not been authenticated"
}
Logout URL /api/auth/logout
- open the URL in the same window
POST api/auth/login_user
PARAMS
- Body
{
googleToken : googleToken
}
- googleToken was
tokenIdgiven by google
Success : (Status code - 200)
{
"error":false,
"message":"user has been successfully authenticated",
"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ",
"user":{
"_id":"4038g8986ac64fce3ac17a0a",
"name":"masai",
"email":"masai@gmail.com",
"role":"user",
"profilePic":"https://lh3.googleusercontent.com/a-/AOh14GjiTkKxyNG10NjIhfuUsTJcRIne0j33RFWUZV1C=s96-c",
}
}
Error : (Status code - 401)
{
"authenticated":false,
"error":true,
"message": error message
}