Authentication flows
Hybrid refresh token
Renew Salesforce hybrid app access and web-session state with the hybrid refresh grant.
Use the hybrid refresh-token flow for refresh tokens associated with supported Salesforce hybrid sessions. It renews the access token and lets Salesforce return the web-session information required by hybrid applications.
Refresh a hybrid session
import {
createMemoryRefreshTokenStore,
SalesforceAuth,
} from "@kysoql/auth";
export function refreshHybrid(refreshToken: string) {
const auth = new SalesforceAuth({
loginUrl: "https://example.my.salesforce.com",
clientId: "external-client-app-id",
});
const store = createMemoryRefreshTokenStore(refreshToken);
return auth.refreshHybridToken({
refreshToken,
refreshTokenStore: store,
});
}Use a durable refresh-token store when the hybrid refresh
token must survive process restarts. For auth.storedRefreshToken(), set
refreshMode: "hybrid" so its provider uses hybrid_refresh instead of the
standard refresh grant.