https://github.com/arpitbhalla/golang-oauth
Auth using Redis, Mongodb, Golang
https://github.com/arpitbhalla/golang-oauth
authentication golang mongodb redis
Last synced: 8 months ago
JSON representation
Auth using Redis, Mongodb, Golang
- Host: GitHub
- URL: https://github.com/arpitbhalla/golang-oauth
- Owner: arpitBhalla
- Created: 2021-04-21T09:03:58.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-23T10:18:39.000Z (about 5 years ago)
- Last Synced: 2025-07-22T10:53:14.273Z (11 months ago)
- Topics: authentication, golang, mongodb, redis
- Language: Go
- Homepage:
- Size: 704 KB
- Stars: 13
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OAuth2.0 API
- **Golang**
- **MongoDB** for storing data
- **Redis** to Store JWT Metadata
## Base URL
http://34.69.239.180
## Authentication Header
`Bearer: `
## Endpoints
### **Register**
> **`POST`** [**/register**](http://34.69.239.180/register)
**Request Body**
```json
{
"name": "YOUR NAME",
"email": "EMAIL",
"password": "PASSWORD"
}
```
**Response**
```json
{
"code": 200
}
```
### **Login**
> **`POST`** [**/login**](http://34.69.239.180/login)
**Request Body**
```json
{
"email": "EMAIL",
"password": "PASSWORD"
}
```
**Response**
```json
{
"code": 200,
"accessToken": "JWT TOKEN",
"refreshToken": "JWT TOKEN"
}
```
### **Refresh Token**
> **`POST`** [**/refresh**](http://34.69.239.180/refresh)
**Request Body**
```json
{
"refreshToken": "JWT TOKEN"
}
```
**Response**
```json
{
"accessToken": "JWT TOKEN"
}
```
### **Logout**
> **`POST`** [**/logout**](http://34.69.239.180/logout)
**Response**
```json
{
"code": 200
}
```
### **Get your profile**
> **`GET`** [**/profile**](http://34.69.239.180/profile)
**Response**
```json
{
"code": 200,
"_id": "MONGODB ID",
"name": "NAME",
"email": "EMAIL"
}
```
### **Dump all profile**
> **`GET`** [**/all**](http://34.69.239.180/all)
**Response**
```json
{
"code": 200,
"data": [
{
"_id": "MONGODB ID",
"name": "NAME",
"email": "EMAIL"
}
]
}
```