import { Issuer } from 'openid-client';
const issuer = await Issuer.discover('https://account.tooco.net/sso');
const client = new issuer.Client({
client_id: 'your_client_id',
client_secret: 'your_client_secret',
redirect_uris: ['http://localhost:3000/callback']
});
const authUrl = client.authorizationUrl({
scope: 'openid profile email'
});
import (
"context"
"github.com/coreos/go-oidc/v3/oidc"
"golang.org/x/oauth2"
)
func InitOIDC() {
provider, _ := oidc.NewProvider(context.Background(), "https://account.tooco.net/sso")
oauth2Config := oauth2.Config{
ClientID: "your_client_id",
ClientSecret: "your_client_secret",
RedirectURL: "http://localhost:8080/callback",
Endpoint: provider.Endpoint(),
Scopes: []string{oidc.ScopeOpenID, "profile", "email"},
}
}
from authlib.integrations.starlette_client import OAuth
oauth = OAuth()
oauth.register(
name='auth_server',
client_id='your_client_id',
client_secret='your_client_secret',
server_metadata_url='https://account.tooco.net/sso/.well-known/openid-configuration',
client_kwargs={'scope': 'openid profile email'}
)
async def login_route(request):
return await oauth.auth_server.authorize_redirect(request, redirect_uri)
curl -X POST "https://account.tooco.net/sso/token" \
-d "grant_type=authorization_code" \
-d "code=AUTHORIZATION_CODE" \
-u "your_client_id:your_client_secret"