Introduction
⚡️ GAuth can help simplify the authorization login process for third-party platforms.
Currently Supported
Installation
go get github.com/LeoInnovateLab/gauth
Step
- Register as a developer account for third-party platforms, such as: GitHub developer account.
- Create an application for the third-party platform and obtain configuration information.
Client Id
Client Secrets
Callback URL
- Utilize GAuth for authorization login.
// create authorization request
authRequest, err := gauth.New().
Source("github").
ClientId("your_client_id").
ClientSecret("your_client_secret").
RedirectUrl("http://localhost:8080/auth/github/callback").
Build()
// generate authorization URL
authorizeUrl, err := authRequest.Authorize("state")
// After authorization login, it will return login information.
response, err := authRequest.Login(callback)
Demo
Recommend using GAuth Demo for testing.
-
Fill in the requested
App Id
andApp secrets
in.env.demo
-
Then, Start project, visit
http://localhost:8080/