https://github.com/yingyeothon/auth-api
A simple Serverless auth API.
https://github.com/yingyeothon/auth-api
auth jwt serverless
Last synced: about 1 year ago
JSON representation
A simple Serverless auth API.
- Host: GitHub
- URL: https://github.com/yingyeothon/auth-api
- Owner: yingyeothon
- Created: 2019-12-20T15:49:39.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-11T04:32:24.000Z (almost 2 years ago)
- Last Synced: 2025-02-02T12:51:50.916Z (about 1 year ago)
- Topics: auth, jwt, serverless
- Language: TypeScript
- Size: 923 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Auth
A simple Serverless auth API.
## Development
```bash
yarn
yarn deploy
```
### Environment
- `AWS_PROFILE`
- `STAGE`
- `JWT_SECRET_KEY`
### `envrc` example
```bash
export AWS_PROFILE="it-is-me"
export STAGE="production"
export JWT_SECRET_KEY="something-very-complex-secret-key"
```
## API docs
### Simple
Request:
```text
POST /simple
{
"name": string;
"email": string | undefined;
"application": string;
}
```
Response: `JWT({name}, 1h)`
Request example with cURL.
```bash
$ curl -XPOST https://API.DOMAIN.TLD/simple -d '{"name":"lacti","email":"lactrious@gmail.com","application":"test"}'
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoibGFjdGkiLCJlbWFpbCI6ImxhY3RyaW91c0BnbWFpbC5jb20iLCJhcHBsaWNhdGlvbnMiOlsidGVzdCJdLCJpYXQiOjE2MjEwNDQyNDIsImV4cCI6MTYyMTA0Nzg0Mn0.SECRET_ENCODED
```
### Google
Request:
```text
POST /google
{
"token": string;
"application": string;
}
```
Response: `JWT({name, email}, 7d)`
Request example with cURL.
```bash
$ curl -XPOST https://API.DOMAIN.TLD/google -d '{"token":"GOOGLE_AUTH_TOKEN","application":"test"}'
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.PAYLOAD_ENCODED.SECRET_ENCODED
```