actually do some OAuth

This commit is contained in:
2026-08-06 10:08:07 -04:00
parent 349ab612d6
commit c305b53f11
8 changed files with 78 additions and 15 deletions
+16 -7
View File
@@ -1,22 +1,31 @@
package auth
import (
"context"
"github.com/coreos/go-oidc/v3/oidc"
"golang.org/x/oauth2"
)
var oauthConfigs []oauth2.Config
var OAuthConfigs []oauth2.Config
func CreateTestOAuth() {
oauthEndpoint := oauth2.Endpoint{
AuthURL: "https://account.astraltech.xyz/application/o/authorize/",
TokenURL: "https://account.astraltech.xyz/application/o/token/",
ctx := context.Background()
provider, err := oidc.NewProvider(ctx, "https://account.astraltech.xyz/application/o/stalwart/")
if err != nil {
panic(err)
}
oauthConfig := oauth2.Config{
ClientID: "stalwart-webui",
Scopes: []string{"openid", "profile", "email"},
Endpoint: oauthEndpoint,
RedirectURL: "http://localhost:8080/callback",
Endpoint: provider.Endpoint(),
Scopes: []string{
oidc.ScopeOpenID,
"profile",
"email",
},
}
oauthConfigs = append(oauthConfigs, oauthConfig)
OAuthConfigs = append(OAuthConfigs, oauthConfig)
}