Package gauth is go version of gauth sdk.
광주소프트웨어 마이스터고등학교의 통합 계정 관리 서비스인 GAuth
를 Golang
으로 더 손쉽게 사용할 수 있도록 만들어진 라이브러리 입니다
go get -u https://github.com/onee-only/gauth-go
package main
import(
"github.com/onee-only/gauth-go"
)
func main() {
client := gauth.NewDefaultClient(gauth.ClientOpts{
ClientID: "clientID",
ClientSecret: "clientSecret",
RedirectURI: "localhost:8080",
})
}
package main
import (
"log"
"github.com/onee-only/gauth-go"
)
func issueCode(client *gauth.Client) {
code, err := client.IssueCode("email", "password")
if err != nil {
// You shouldn't use panic in your code.
panic(err)
}
log.Println(code)
}
package main
import (
"log"
"github.com/onee-only/gauth-go"
)
func issueToken(client *gauth.Client) {
accessToken, refreshToken, err := client.IssueToken("code")
if err != nil {
// You shouldn't use panic in your code.
panic(err)
}
log.Println(accessToken)
log.Println(refreshToken)
}
package main
import (
"log"
"github.com/onee-only/gauth-go"
)
func reIssueToken(client *gauth.Client) {
access, refresh, err := client.ReIssueToken("refreshToken")
if err != nil {
// You shouldn't use panic in your code.
panic(err)
}
log.Println(access)
log.Println(refresh)
}
package main
import (
"log"
"github.com/onee-only/gauth-go"
)
func getUserInfo(client *gauth.Client) {
info, err := client.GetUserInfo("accessToken")
if err != nil {
// You shouldn't use panic in your code.
panic(err)
}
log.Println(info)
}