An open API service indexing awesome lists of open source software.

https://github.com/alexey-dobry/go-auth

Go Auth is simple authorization service
https://github.com/alexey-dobry/go-auth

gorm grpc jwt

Last synced: about 1 month ago
JSON representation

Go Auth is simple authorization service

Awesome Lists containing this project

README

          

# Go Auth
> Simple authentication and permission checker service

### Requirements:
#### Docker:
![docker](https://badgen.net/static/docker/@latest/purple)

You can install Docker there

### Installing:
1. Clone repository
2. Go to ./auth-service/config and setup config.yaml as specified in config.example.yaml

Note: it is crucial to set repository:host value equal to "auth-database"

3. Start the application

- for Windows users:

```bash
docker-compose build
```
```bash
docker-compose up
```

- for Linux users:

```bash
docker compose build
```
```bash
docker compose up
```

### GRPC methods
- **Register**: registers user in auth service and returns pair of jwt tokens(refresh and access)
- **Login**: returns pair of jwt tokens(refresh and access) if user is registered
- **Refresh**: returns pair of jwt tokens(refresh and access) if refresh token is valid
- **Validate**: validates access token

### Requests examples
- **Register**:
```
{
"email": "Roberto@gmail.com",
"first_name": "Andrey",
"last_name": "Svishev",
"password": "lorem_ipsum",
"username": "Youtubelover"
}
```
- **Login**:
```
{
"email": "Roberto@gmail.com",
"password": "lorem_ipsum"
}
```
- **Refresh**:
```
{
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTYxMzU2MzIsImlkIjowLCJ1c2VybmFtZSI6IiIsImZpcnN0X25hbWUiOiIiLCJsYXN0X25hbWUiOiIiLCJpc19hZG1pbiI6ZmFsc2V9.DfqoXRbnabTbL8tL6HWej7lW_AciEV8mNriMlLxiM-E"
}
```
- **Validate**:
```
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTYwNTY0MzIsImlkIjowLCJ1c2VybmFtZSI6ImV1IiwiZmlyc3RfbmFtZSI6Im1hZ25hIGV1IGN1bHBhIHZlbGl0IiwibGFzdF9uYW1lIjoiZXUgZnVnaWF0IG1pbmltIGFsaXF1YSIsImlzX2FkbWluIjpmYWxzZX0.lZZWH37PaWM2c0_MsamWjiW4qt6PzEkjTYQzQ5BgNWk"
}
```

### Response example
```
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTYwNTY0MzIsImlkIjowLCJ1c2VybmFtZSI6ImV1IiwiZmlyc3RfbmFtZSI6Im1hZ25hIGV1IGN1bHBhIHZlbGl0IiwibGFzdF9uYW1lIjoiZXUgZnVnaWF0IG1pbmltIGFsaXF1YSIsImlzX2FkbWluIjpmYWxzZX0.lZZWH37PaWM2c0_MsamWjiW4qt6PzEkjTYQzQ5BgNWk",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTYxMzU2MzIsImlkIjowLCJ1c2VybmFtZSI6IiIsImZpcnN0X25hbWUiOiIiLCJsYXN0X25hbWUiOiIiLCJpc19hZG1pbiI6ZmFsc2V9.DfqoXRbnabTbL8tL6HWej7lW_AciEV8mNriMlLxiM-E"
}
```