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

github.com/jamesonwilliams/golang-sso-google

Go language Single Sign On (SSO) with Google

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

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

GitHub Stars

11

LAST COMMIT

5yrs ago

MAINTAINERS

0

CONTRIBUTORS

2

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
v0.0.0-20170402080021-b3988c8ab879
2yrs ago
No alternatives found
No tutorials found
Add a tutorial