Skip to main content

Rychlý start

Tato sekce vás provede integrací Klubero SSO během několika minut.

Co budete potřebovat

  1. Vaše client_id (poskytnuto podporou Klubero)
  2. Vaše client_secret (pouze pro confidential klienty)
  3. Zaregistrované redirect_uri (např. https://yourapp.com/callback)
  4. Base URL vašeho Klubero SSO (např. https://sso.yourdomain.com)

Krok 1: Zjištění konfigurace

Nejprve ověřte, že je váš SSO server dostupný, načtením OpenID konfigurace:

curl https://your-sso-domain.com/.well-known/openid-configuration

Odpověď:

{
"issuer": "https://your-sso-domain.com/",
"authorization_endpoint": "https://your-sso-domain.com/connect/authorize",
"token_endpoint": "https://your-sso-domain.com/connect/token",
"userinfo_endpoint": "https://your-sso-domain.com/connect/userinfo",
"end_session_endpoint": "https://your-sso-domain.com/connect/logout",
"jwks_uri": "https://your-sso-domain.com/.well-known/jwks",
"scopes_supported": ["openid", "profile", "email", "phone", "address", "offline_access"],
"response_types_supported": ["code", "id_token", "token"],
"grant_types_supported": ["authorization_code", "refresh_token", "client_credentials"],
"token_endpoint_auth_methods_supported": ["client_secret_basic", "client_secret_post"],
"code_challenge_methods_supported": ["S256", "plain"]
}

Krok 2: Sestavení autorizační URL

Přesměrujte uživatele na tuto URL pro zahájení autentizace:

https://your-sso-domain.com/connect/authorize?
client_id=YOUR_CLIENT_ID&
redirect_uri=https://yourapp.com/callback&
response_type=code&
scope=openid%20profile%20email&
state=random_state_value

Krok 3: Zpracování callbacku

Po úspěšném přihlášení je uživatel přesměrován na vaši callback URL:

https://yourapp.com/callback?code=AUTHORIZATION_CODE&state=random_state_value

Krok 4: Výměna kódu za tokeny

curl -X POST https://your-sso-domain.com/connect/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=authorization_code" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET" \
-d "code=AUTHORIZATION_CODE" \
-d "redirect_uri=https://yourapp.com/callback"

Odpověď:

{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 1800,
"refresh_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"id_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"scope": "openid profile email"
}

Krok 5: Získání informací o uživateli

curl https://your-sso-domain.com/connect/userinfo \
-H "Authorization: Bearer ACCESS_TOKEN"

Odpověď:

{
"sub": "550e8400-e29b-41d4-a716-446655440000",
"name": "Jan Novák",
"given_name": "Jan",
"family_name": "Novák",
"email": "jan.novak@example.com",
"email_verified": true
}

Gratulujeme! Úspěšně jste integrovali Klubero SSO. Pokračujte ve čtení pro detailní informace o jednotlivých flow a funkcích.