Quantcast
Channel: Hacker News
Viewing all articles
Browse latest Browse all 25817

Show HN: A microservice that makes adding authentication to your app easy

$
0
0

README.md

A microservice that makes adding authentication with Google or Github to your application easy.

This service allows you to use Google and Github OAuth2 service to add authentication to your applications in a very straightforward way.

It's build with Nginx/OpenResty, Lapis and Docker. This enables the service to be very performant and requires only minimal system resources.

Features

Getting started

  • Install (if you don't have them):
  • Setup required environment variables
  • Run in development mode:
    • Run the application with docker-compose -f docker-compose-dev.yml up
  • Run in production mode:
    • Run the application with docker-compose up
  • Once micro-auth is running, you can point your login to one of the following urls (URLs are for development mode):
    • http://localhost:8080/auth/github: For Github login
    • http://localhost:8080/auth/google: For Google login

Authentication Services

Google

Setup

Visit Google Developers Console and create a new application on Google. Then go to Credentials and create a new OAuth Client ID. Now, get the Client ID and Client secret.

Endpoints

  • http://localhost:8080/auth/google: Endpoint for Google authentication. Point your application to this endpoint to login with Google.

Results

After successfull authentication with Google the user is redirect to the URL specified in GOOGLE_REDIRECT_URL with the access token saved in the access_token query parameter.

Github

Setup

Visit Github and create a new application on Github to get your client id and secret.

Endpoints

  • http://localhost:8080/auth/github: Endpoint for Github authentication. Point your application to this endpoint to login with Github.

Results

After successfull authentication with Github the user is redirect to the URL specified in GITHUB_REDIRECT_URL with the access token saved in the access_token query parameter.

Environment variables

To use the service you must set some required environment variables. These variables can be set in the .env file. Just copy .env.example to .env

$ cp .env.example .env

end set the required variables.

General

  • APP_URL: Specify the URL of micro-auth (default: http://localhost:8080 in development mode). The APP_URL must be set in production mode.

Google

  • GOOGLE_CLIENT_ID: The Google application client id (required)
  • GOOGLE_CLIENT_SECRET: The Google application client secret (required)
  • GOOGLE_REDIRECT_URL: The url to redirect the user once the authentication was successfull

Github

  • GITHUB_CLIENT_ID: The Github application client id (required)
  • GITHUB_CLIENT_SECRET: The Github application client secret (required)
  • GITHUB_REDIRECT_URL: The url to redirect the user once the authentication was successfull

License

See LICENSE

Credits


Viewing all articles
Browse latest Browse all 25817

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>