Skip to main content

Linkedin Authorization

1. Create Linkedin App

create Linkedin app

Then switch to Auth Tab get ClientId and ClientSecret.

create Linkedin app auth

  • Add Callback URL

Linkedin add callback url

warning

Important Note

Client secrets can protect the security of your application, so please ensure that it is not leaked! Also, do not share your client secrets with anyone!!!

2. Integration GAuth

  • Install GAuth
go get github.com/LeoInnovateLab/gauth
  • import register
import (
_ "github.com/LeoInnovateLab/gauth/register"
)
  • Create AuthRequest
authRequest, err := gauth.New().
Source("linkedin").
ClientId("your_app_id").
ClientSecret("your_app_secret").
RedirectUrl("your_callback_url").
Build()
  • Generate Authorize URL
authorizeUrl, err := authRequest.Authorize(utils.CreateState())

You can use this authorizeUrl to redirect.

3. Authorization

Authorization result


"data": {

}

Demo

Recommend using GAuth Demo for testing.

  • Fill in the requested App Id and App secrets in .env.demo

  • Then, Start project, visit http://localhost:8080/

Demo