Skip to content

Golang oAuth2 Google Example for Web and API System

Notifications You must be signed in to change notification settings

ManishPaneri/GoogleLogin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoogleLogin

Golang oAuth2 Google Example for Web and API System

Setup - OAuth client

Construct the OAuth config like this:

var ( googleOauthConfig = &oauth2.Config{ RedirectURL: "http://localhost:9000/GoogleCallback", ClientID: "", ClientSecret: "", Scopes: []string{"https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/userinfo.email"}, Endpoint: google.Endpoint, } oauthStateString = "random" )

Mysql - Database

Construct the DB in Google_User_Table table struct

GoogleUserTable struct { Id int orm:"column(id);auto" Name string orm:"column(name);size(225)" Email string orm:"column(email);size(225)" Role string orm:"column(role)" Picture string orm:"column(picture)" Hd string orm:"column(hd)" VerifiedEmail int8 orm:"column(verified_email)" AuthId string orm:"column(auth_id);size(256)" }

About

Golang oAuth2 Google Example for Web and API System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages