Skip to content

Dockerized example of Single Sign-On (SSO) written in Go and React

License

Notifications You must be signed in to change notification settings

BARJ/go-single-sign-on-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example Single Sign-On (SSO)

Alt text

demo

Alt text

Getting Started

Usage

Run the dockerized application by executing the following command:

docker-compose up

And visit https://localhost with your favourite web browser.

Prerequisites

Single Sign-On Providers

You will need to configure at least 1 single sign-on provider. The more the better.

Facebook

  1. Go to Facebook for Developers.
  2. Go to My Apps and create a new app by clicking on Create App (select "Build Connected Experiences").
  3. Scroll down and under Add Products to Your App, click Set Up in the Facebook Login card. In the left side navigation panel, go to Facebook Login > Settings, under Valid OAuth Redirect URIs enter https://localhost/api/v1/single-sign-on/facebook/callback.
  4. Go to Settings > Basic and copy App ID and App Secret.
  5. In docker-compose.yml, replace the values of FACEBOOK_CLIENT_ID and FACEBOOK_CLIENT_SECRET with the values of App ID and App Secret respectively.

GitHub

  1. On github.com, go to Settings > Developer Settings > OAuth Apps (or click here).
  2. Click on New OAuth App.
  3. Fill in https://localhost for Homepage URL and https://localhost/api/v1/single-sign-on/github/callback for Authorization callback URL, and click on Register Application.
  4. From General, copy Client ID and generate a new Client Secret.
  5. In docker-compose.yml, replace the values of GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET with the values of Client ID and Client Secret respectively.

Google

  1. Go to Google Console Developer APIs & Services
  2. From the projects list, create a new project.
  3. Go to OAuth consent screen in the left side navigation panel.
  4. Configure the OAuth consent screen. Fill in all required fields and click save and continue.
  5. Go to Credentials in the left side navigation panel.
  6. Click create credentials in the top navigation panel and select OAuth Client ID. For Application Type select Web application. Under Authorized redirect URIs add the callback uri https://localhost/api/v1/single-sign-on/google/callback. Finally, click create.
  7. Copy Client ID and Client Secret.
  8. In docker-compose.yml, replace the values of GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET with the values of Client ID and Client Secret respectively.

If you're experiencing difficulties setting up the OAuth Client, see https://support.google.com/cloud/answer/6158849.

Single Sign-On Flow

Alt text

About

Dockerized example of Single Sign-On (SSO) written in Go and React

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published