SSO Reference | PropelAuth BYO Documentation

SSO Reference

Initiate OIDC Login

Kick off the login process for a user with an OIDC client.

Arguments

Successful Response

Error Types

const auth = createClient({ url, integrationKey });

const result = await auth.sso.initiateOidcLogin({
  oidcClientId: "0oaulhbkt9YBiT3Pn697",
  postLoginRedirectUrl: "https://app.example.com/authorization-code/callback"
});

if (result.ok) {
  console.log("OIDC login initiated successfully");
  res.redirect(result.data.sendUserToIdpUrl);
} else {
  console.log(`Error: ${result.error}`);
}

Complete OIDC Login

Finish the login process for a user with an OIDC client and get the user information.

Arguments

Successful Response

Error Types

const result = await auth.sso.completeOidcLogin({
  stateFromCookie: "s8lXVPo8VGvLxOveST3HqQ",
  callbackPathAndQueryParams: "/authorization-code/callback?code=1.AVEAOVh5sbKhzUa-5NiHtq5gP..."
});

if (result.ok) {
  const { email, oidcUserId, customerId } = result.data;
  if (result.data.postLoginRedirectUrl) {
    res.redirect(result.data.postLoginRedirectUrl);
  }
} else {
  console.log(`Error: ${result.error}`);
}