-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgokinde.go
41 lines (34 loc) · 950 Bytes
/
gokinde.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package gokinde
import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/session"
"golang.org/x/oauth2"
)
var (
store *session.Store
client *oauth2.Config
issuerUrl string
)
func SetupKinde(app *fiber.App, credentials KindeCredentials) {
store = session.New(session.Config{
Expiration: 24 * 60 * 60, // 24 hours
})
client = &oauth2.Config{
ClientID: credentials.ClientID,
ClientSecret: credentials.Secret,
RedirectURL: credentials.RedirectUrl,
Endpoint: oauth2.Endpoint{
AuthURL: credentials.IssuerBaseUrl + "/oauth2/auth",
TokenURL: credentials.IssuerBaseUrl + "/oauth2/token",
},
Scopes: []string{"openid", "profile", "email"},
}
issuerUrl = credentials.IssuerBaseUrl
// URLs setup
kindeUrls := KindeURLs{
SiteUrl: credentials.SiteUrl,
RedirectUrl: credentials.RedirectUrl,
UnAuthorisedUrl: credentials.UnAuthorisedUrl,
}
defineRoutes(app, kindeUrls)
}