Overview
The authorization URL endpoint initiates the OAuth 2.0 authorization flow for Single Sign-On (SSO). This endpoint redirects users to their configured Identity Provider (IdP) for authentication.Endpoint
GET
{SCALEKIT_ENVIRONMENT_URL}/oauth/authorizeQuery Parameters
Your Scalekit application client ID. Obtain this from the Scalekit Dashboard under API Config.
The URL where users will be redirected after authentication. Must match one of the redirect URIs configured in your Scalekit application settings.
OAuth response type. Use
code for authorization code flow.Space-separated list of OAuth scopes. Common scopes:
openid, email, profile.Unique identifier of the organization. Use this to initiate SSO for a specific organization. Either
organization_id or connection_id must be provided.Unique identifier of the SSO connection. Use this to initiate SSO with a specific connection. Either
organization_id or connection_id must be provided.Optional state parameter for CSRF protection. The value will be returned in the callback.
Optional nonce value for replay attack protection in OpenID Connect flows.
Request Examples
Response
The endpoint performs a 302 redirect to the configured Identity Provider’s login page. After successful authentication, the IdP redirects back to yourredirect_uri with an authorization code.
Callback Parameters
Your redirect URI will receive the following query parameters:Authorization code to exchange for tokens. This code is single-use and expires after a short period (typically 10 minutes).
The state parameter you provided in the authorization request. Use this to prevent CSRF attacks.
Callback Example
Error Responses
Error code indicating what went wrong.
Human-readable description of the error.
Common Errors
| Error Code | Description | Solution |
|---|---|---|
invalid_request | Missing or invalid required parameters | Verify all required parameters are included |
unauthorized_client | Invalid client_id | Check your client_id in Scalekit Dashboard |
invalid_redirect_uri | Redirect URI not configured | Add the redirect_uri to your application settings |
invalid_scope | Requested scope is invalid | Use valid OAuth scopes (openid, email, profile) |
organization_not_found | Organization ID does not exist | Verify the organization_id is correct |
connection_not_found | Connection ID does not exist | Verify the connection_id is correct |
Security Considerations
Implementation Flow
- Generate Authorization URL: Create the authorization URL with appropriate parameters
- Redirect User: Redirect the user’s browser to the authorization URL
- User Authenticates: User logs in through their Identity Provider
- Receive Callback: Handle the callback with the authorization code
- Exchange Code: Use the Token Exchange endpoint to get user tokens
Next Steps
Token Exchange
Exchange authorization codes for access tokens
Session Management
Validate and manage user sessions