Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

jamesonwilliams/golang-sso-google

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

golang-sso-google

Go language implementation of Single Sign On with Google.

Credit to Skarlso, from whom I forked this repo.

Installation

go get github.com/jamesonwilliams/golang-sso-google

Google Credentials

In order for the Google Authentication to work, you'll need developer credentials which the this application gathers from a file in the root directory called credentials.json. The structure of this file should be like this:

{
  "clientId":"hash.apps.googleusercontent.com",
  "clientSecret":"somesecrethash"
}

To obtain these credentials, please navigate to this site and follow the procedure to setup a new project: Google Developer Console.

Dependencies

Uses a DynamoDB table called Users. You can create this table with:

aws dynamodb \
    --profile default \
    --region us-west-2 \
create-table \
    --table-name Users \
    --key-schema \
        AttributeName=email,KeyType=HASH \
    --attribute-definitions \
        AttributeName=email,AttributeType=S \
    --provisioned-throughput \
        ReadCapacityUnits=1,WriteCapacityUnits=1

You will also need to arrange for AWS credentials that have sufficient permissions to read and write to that table to be in your environment.

Easiest is to just put them in ~/.aws/config.

To gather all the libraries this project uses, simply execute from the root:

go get -v "github.com/gin-gonic/gin"
go get -v "github.com/gin-gonic/contrib/sessions"
go get -v "golang.org/x/oauth2"
go get -v "golang.org/x/oauth2/google"
go get -v "gopkg.in/mgo.v2"
go get -v "gopkg.in/mgo.v2/bson"
# etc.

Or just:

go get

Running

go build
./golang-sso-google &
google-chrome http://127.0.0.1:9090/login &

Screenshots

Login Button Google Redirect

Releases

No releases published

Packages

No packages published

Languages

  • Go 90.6%
  • Shell 6.0%
  • CSS 3.4%