Kysoql
API referenceClasses

SalesforceAuth

Generated API reference for SalesforceAuth in @kysoql/auth.

@kysoql/auth / SalesforceAuth

Bound Salesforce OAuth client.

The class is the primary ergonomic API for applications. The standalone functions remain exported for advanced composition and backwards compatibility.

Constructors

Constructor

new SalesforceAuth(options): SalesforceAuth;

Creates a Salesforce authentication helper bound to a login URL and Connected App client ID.

Parameters

ParameterType
optionsSalesforceAuthOptions

Returns

SalesforceAuth

Methods

generatePkcePair()

generatePkcePair(): Promise<PkcePair>;

Generate an RFC 7636 S256 verifier/challenge pair.

Returns

Promise<PkcePair>


authorizationUrl()

authorizationUrl(options): string;

Build a standard OAuth authorization URL using this client's base config.

Parameters

ParameterType
optionsBoundAuthorizationUrlOptions

Returns

string


exchangeAuthorizationCode()

exchangeAuthorizationCode(options): Promise<SalesforceOAuthSession>;

Exchange a standard authorization code.

Parameters

ParameterType
optionsBoundAuthorizationCodeOptions

Returns

Promise<SalesforceOAuthSession>


exchangeHybridAuthorizationCode()

exchangeHybridAuthorizationCode(options): Promise<SalesforceOAuthSession>;

Exchange a Salesforce hybrid-app authorization code.

Parameters

ParameterType
optionsBoundAuthorizationCodeOptions

Returns

Promise<SalesforceOAuthSession>


refreshToken()

refreshToken(options): Promise<SalesforceOAuthSession>;

Refresh a standard OAuth session.

Parameters

ParameterType
optionsBoundRefreshTokenOptions

Returns

Promise<SalesforceOAuthSession>


refreshHybridToken()

refreshHybridToken(options): Promise<SalesforceOAuthSession>;

Refresh a Salesforce hybrid-app session.

Parameters

ParameterType
optionsBoundRefreshTokenOptions

Returns

Promise<SalesforceOAuthSession>


clientCredentials()

clientCredentials(options): Promise<SalesforceOAuthSession>;

Authenticate a server integration with the client-credentials flow.

Parameters

ParameterType
optionsBoundClientCredentialsOptions

Returns

Promise<SalesforceOAuthSession>


jwtBearer()

jwtBearer(options): Promise<SalesforceOAuthSession>;

Authenticate the configured integration user with Salesforce JWT bearer. The JWT assertion is created and exchanged in one call.

Parameters

ParameterType
optionsSalesforceJwtBearerOptions

Returns

Promise<SalesforceOAuthSession>


createClientAssertion()

createClientAssertion(options): Promise<string>;

Create a private_key_jwt assertion for a later token request.

Parameters

Returns

Promise<string>


samlBearer()

samlBearer(options): Promise<SalesforceOAuthSession>;

Exchange a SAML 2.0 bearer assertion.

Parameters

ParameterType
optionsBoundSamlBearerOptions

Returns

Promise<SalesforceOAuthSession>


samlAssertion()

samlAssertion(options): Promise<SalesforceOAuthSession>;

Exchange a Salesforce SAML assertion for API access.

Parameters

ParameterType
optionsBoundSamlAssertionOptions

Returns

Promise<SalesforceOAuthSession>


tokenExchange()

tokenExchange(options): Promise<SalesforceOAuthSession>;

Exchange a supported subject token through Salesforce OAuth token exchange.

Parameters

ParameterType
optionsBoundTokenExchangeOptions

Returns

Promise<SalesforceOAuthSession>


requestDeviceAuthorization()

requestDeviceAuthorization(options?): Promise<DeviceAuthorization>;

Start the device authorization flow.

Parameters

ParameterType
optionsBoundDeviceAuthorizationOptions

Returns

Promise<DeviceAuthorization>


pollDeviceAuthorization()

pollDeviceAuthorization(options): Promise<SalesforceOAuthSession>;

Perform one device-flow polling exchange.

Parameters

ParameterType
optionsBoundDeviceTokenOptions

Returns

Promise<SalesforceOAuthSession>


codeCredentialsAuthorization()

codeCredentialsAuthorization(options): HeadlessAuthorizationRequest;

Build an Experience Cloud Authorization Code and Credentials request.

Parameters

ParameterType
optionsBoundCodeCredentialsAuthorizationOptions

Returns

HeadlessAuthorizationRequest


guestAuthorization()

guestAuthorization(options): HeadlessAuthorizationRequest;

Build the Experience Cloud guest Code and Credentials request.

Parameters

ParameterType
optionsBoundHeadlessGuestAuthorizationOptions

Returns

HeadlessAuthorizationRequest


firstPartyAuthorizationChallenge()

firstPartyAuthorizationChallenge(options): Promise<FirstPartyAuthorizationChallenge>;

Call OAuth 2.0 for First-Party Applications authorization_challenge.

Parameters

ParameterType
optionsBoundFirstPartyAuthorizationChallengeOptions

Returns

Promise<FirstPartyAuthorizationChallenge>


storedRefreshToken()

storedRefreshToken(options): StoredRefreshTokenAuth;

Create a refresh-token-backed session manager bound to this client.

Parameters

ParameterType
optionsBoundStoredRefreshTokenAuthOptions

Returns

StoredRefreshTokenAuth

Properties

PropertyModifierTypeDescription
loginUrlreadonlystringSalesforce login or My Domain base URL.
clientIdreadonlystringConnected App consumer key / OAuth client ID.

On this page