Skip to content

arpitBhalla/golang-oauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OAuth2.0 API

  • Golang
  • MongoDB for storing data
  • Redis to Store JWT Metadata

Base URL

http://34.69.239.180

Authentication Header

Bearer: <Token>

Endpoints

Register

POST /register

Request Body

{
  "name": "YOUR NAME",
  "email": "EMAIL",
  "password": "PASSWORD"
}

Response

{
  "code": 200
}

Login

POST /login

Request Body

{
  "email": "EMAIL",
  "password": "PASSWORD"
}

Response

{
  "code": 200,
  "accessToken": "JWT TOKEN",
  "refreshToken": "JWT TOKEN"
}

Refresh Token

POST /refresh

Request Body

{
  "refreshToken": "JWT TOKEN"
}

Response

{
  "accessToken": "JWT TOKEN"
}

Logout

POST /logout

Response

{
  "code": 200
}

Get your profile

GET /profile

Response

{
  "code": 200,
  "_id": "MONGODB ID",
  "name": "NAME",
  "email": "EMAIL"
}

Dump all profile

GET /all

Response

{
  "code": 200,
  "data": [
    {
      "_id": "MONGODB ID",
      "name": "NAME",
      "email": "EMAIL"
    }
  ]
}

About

Auth using Redis, Mongodb, Golang

Topics

Resources

Stars

Watchers

Forks