https://github.com/billsjc/applelogin
a tool of sign in with apple of Golang
https://github.com/billsjc/applelogin
apple go golang signinwithapple
Last synced: 9 months ago
JSON representation
a tool of sign in with apple of Golang
- Host: GitHub
- URL: https://github.com/billsjc/applelogin
- Owner: BillSJC
- License: mit
- Created: 2019-06-29T10:23:27.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-16T12:31:53.000Z (over 6 years ago)
- Last Synced: 2025-04-09T19:02:08.991Z (about 1 year ago)
- Topics: apple, go, golang, signinwithapple
- Language: Go
- Size: 59.6 KB
- Stars: 30
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# appleLogin
A tool for `Sign In with Apple` REST API written in `Golang`


### What it dose?
- Full support of JWT Authorization for Apple Developer
- Quick API to finish [Sign In with Apple REST API](https://developer.apple.com/documentation/signinwithapplerestapi) on Apple Document
- Tool to create callBackURL
### Install:
> go get github.com/BillSJC/appleLogin
### Test:
> go test
### Quick Start
```go
package main
import (
"fmt"
"github.com/BillSJC/appleLogin"
)
func main(){
a := appleLogin.InitAppleConfig("123ABC456D", //Team ID
"com.example.pkg", //Client ID (Service ID)
"https://www.example.com/callback", //Callback URL
"your Apple Key ID") //Key ID
//import cert
err := a.LoadP8CertByFile("path to your p8 cert file") //path to cert file
//or you can load cert from a string
err = a.LoadP8CertByByte([]byte("set your cert string here"))
if err != nil {
panic(err)
}
//create callback URL
callbackURL := a.CreateCallbackURL("state here")
fmt.Println(callbackURL)
// ... some code to get Apple`s AuthorizationCode
code := "xxxx"
token,err := a.GetAppleToken(code,3600)
if err != nil {
panic(err)
}
fmt.Println(token)
}
```
### Functions
#### InitAppleConfig
#### LoadP8CertByFile
#### LoadP8CertByByte
#### CreateCallbackURL
#### GetAppleToken