Kysoql
Authentication flows

Hybrid web-server

Exchange a Salesforce hybrid web-server authorization code for API and web-session state.

Use the hybrid web-server flow when a hybrid application needs Salesforce API access together with direct Salesforce web-session management. For a service that only executes REST/SOQL, the ordinary web-server flow is usually simpler.

Exchange the authorization code

import { SalesforceAuth } from "@kysoql/auth";

export function exchangeHybridCode(code: string) {
  const auth = new SalesforceAuth({
    loginUrl: "https://example.my.salesforce.com",
    clientId: "external-client-app-id",
  });

  return auth.exchangeHybridAuthorizationCode({
    code,
    redirectUri: "https://app.example.com/oauth/callback",
  });
}

The helper sends Salesforce's hybrid_auth_code grant. It supports the same confidential-client authentication inputs as the normal authorization-code exchange.

When the resulting hybrid session expires, use the separate hybrid refresh-token flow.

Kysoql intentionally does not expose the retiring hybrid user-agent flow.

On this page