Sign inSign up

afindlator/auth-api

By afindlator

•Updated over 9 years ago

Handles user authentication and autherization

Image
0

1.2K

afindlator/auth-api repository overview

⁠README

Manages user authentication and autherization using web tokens

⁠Requirements
⁠Database Setup

To setup the auth database, download and execute the auth.sql⁠ on the MYSQL server

⁠Starting the Auth-Api Service

With the auth database setup, start the Auth service with the command:

docker run --name some-auth-api -e AUTH_DB="mysqlusername:mysqlpassword@tcp(mysqlhost:mysqlport)/auth?charset=utf8" -d afindlator/auth-api:tag

  • mysqlusername: Username used to login to the MYSQL server
  • mysqlpassword: Password used to login to the MYSQL server
  • mysqlhost: MYSQL server hostname or IP address
  • mysqlport: MYSQL server port

⁠Api
⁠Refresh Tokens

Returns a refresh token to be used to request short lived access tokens based on username and password.

  • Url: /refreshtokens

  • Method: POST

  • Data Params:
    { "username": "myusername", "password": "mypassword" }

  • Success Response Code: 200

  • Success Response Body:(string) eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE0ODc1ODQ1MjUsImV4cCI6MTQ4NzY3MDkyNSwic3ViIjoicm9vdCIsImF1ZCI6InJlZnJlc2gifQ==.RX_tDZn44dWglb1wtmnyxXhOJbqV6UBwindQQ2i9vzQ=

  • Error Response Codes:

    • 500 - Fatal error caused due to server faults

    • 401 - Bad username or password

⁠Access Tokens

Returns an accesd token to be used to access published services.

  • Url: /accesstokens

  • Method: POST

  • Data Params:
    {"app": "servicename", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE0ODc1ODQ1MjUsImV4cCI6MTQ4NzY3MDkyNSwic3ViIjoicm9vdCIsImF1ZCI6InJlZnJlc2gifQ==.RX_tDZn44dWglb1wtmnyxXhOJbqV6UBwindQQ2i9vzQ="}

  • Success Response Code: 200

  • Success Response Body:(string) eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE0ODc1ODQ1MjUsImV4cCI6MTQ4NzY3MDkyNSwic3ViIjoicm9vdCIsImF1ZCI6InJlZnJlc2gifQ==.RX_tDZn44dWglb1wtmnyxXhOJbqV6UBwindQQ2i9vzQ=

  • Error Response Codes:

    • 500 - Fatal error caused due to server faults

    • 401 - Bad username or password

Tag summary

Content type

Image

Digest

Size

3.8 MB

Last updated

over 9 years ago

docker pull afindlator/auth-api