Skip to main content

Authorization URL

Authorization URL is the first step in the Single Sign-on flow where you will redirect the user to Scalekit to authenticate the user with the appropriate Identity Provider.

Your application constructs a URL with specific parameters that tell the authorization server(in this case: Scalekit) what the app is requesting. This URL looks like:

https://b2b-app.scalekit.dev/oauth/authorize?
response_type=code&
client_id=skc_1234&
scope=openid%20profile&
redirect_uri=https%3A%2F%2Fyoursaas.com%2Fcallback&
organization_id=org_1243412&
state=aHR0cHM6Ly95b3Vyc2Fhcy5jb20vZGVlcGxpbms%3D

Parameters

ParameterRequirementDescription
client_idRequiredUnique identifier obtained from the API Credentials page
nonceOptionalRandom value for replay protection
organization_idRequired*Identifier for the organization initiating SSO
connection_idRequired*Identifier for the specific SSO connection
domainRequired*Domain part of the email address configured for an organization
providerRequired*Unique provider name for Social Login.
Currently, we support the following providers: google, microsoft, github, gitlab, linkedin, salesforce
response_typeRequiredMust be set to code
redirect_uriRequiredURL where the response is sent, must match an authorized value
scopeRequiredMust be set to openid email profile
stateOptionalOpaque string for request-response correlation
login_hintOptionalEmail address of the user for authentication hint

* One of organization_id, connection_id, domain, or provider must be provided.

Usage Notes

  1. The redirect_uri must exactly match one of the authorized redirect values set in the API Credentials page.
  2. The state parameter is recommended for security purposes, including protection against cross-site request forgery.
  3. The login_hint can be used to prefill login information at the identity provider.

SDK Usage

import { ScalekitClient } from '@scalekit-sdk/node';

const scalekit = new ScalekitClient(
'<SCALEKIT_ENVIRONMENT_URL>',
'<SCALEKIT_CLIENT_ID>',
'<SCALEKIT_CLIENT_SECRET>',
);

const options = {
loginHint: 'user@example.com',
organizationId: 'org_123235245',
};

const authorizationURL = scalekit.getAuthorizationUrl(
redirectUri,
options,
);

Is this page helpful? Yes No