package
1.0.17
Repository: https://github.com/parinyapt/golang_utils.git
Documentation: pkg.go.dev

# README

PTGU OAuth Line

Import

import (
	PTGUoauth "github.com/parinyapt/golang_utils/oauth/line/v1"
)

Example

Config OAuth

lineOAuth := PTGUoauth.NewLineOAuth(&PTGUoauth.LineOAuthConfig{
  ClientID:     "xxxxxxxxxx",
  ClientSecret: "xxxxxxxxxx",
  RedirectURL:  "https://example.com/callback",
})

Generate Login URL

loginURL := lineOAuth.GenerateOAuthURL(PTGUoauth.OptionLineGenerateOAuthURL{
  Scopes: []string{
    "openid",
    "profile",
    "email",
  },
  State: "xxxxxxxxxx",
})

Get Access, Refresh, ID Token by Auth Code

tokenData, err := lineOAuth.GetToken("NVkNw1K197uvr0eLOYNc")
if err != nil {
  panic(err)
}
fmt.Println("AccessToken : " + tokenData.AccessToken)
fmt.Println(tokenData.ExpiresIn)
fmt.Println("IDToken : " + tokenData.IDToken)
fmt.Println("RefreshToken : " + tokenData.RefreshToken)
fmt.Println("Scope : " + tokenData.Scope)
fmt.Println("TokenType : " + tokenData.TokenType)

Get ID Token Info

idTokenInfo, err := lineOAuth.GetIDTokenInfo("eyJ0eXAi....")
if err != nil {
  panic(err)
}
fmt.Println("Nonce : " + PTGUdata.PointerToStringValue(idTokenInfo.Nonce))
fmt.Println("UserID : " + idTokenInfo.Sub)
fmt.Println("Name : " + PTGUdata.PointerToStringValue(idTokenInfo.Name))
fmt.Println("Picture : " + PTGUdata.PointerToStringValue(idTokenInfo.Picture))
fmt.Println("Email : " + PTGUdata.PointerToStringValue(idTokenInfo.Email))

# Functions

No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author