/** * Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import { AuthClientConfig } from './__legacy__/models/client-config'; import { AgentConfig } from './models/agent'; import { AuthCodeResponse } from './models/auth-code-response'; import { AsgardeoClient } from './models/client'; import { Config, SignInOptions, SignOutOptions, SignUpOptions } from './models/config'; import { Crypto } from './models/crypto'; import { EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse } from './models/embedded-flow'; import { OIDCDiscoveryApiResponse } from './models/oidc-discovery'; import { AllOrganizationsApiResponse, Organization, OrgDiscoveryType } from './models/organization'; import { Storage } from './models/store'; import { TokenExchangeRequestConfig, TokenResponse } from './models/token'; import { User, UserProfile } from './models/user'; /** * Options accepted by {@link AsgardeoJavaScriptClient.getOrgAuthorizationUrl}. */ export interface OrgAuthorizationUrlOptions { /** * Additional query parameters to append to the authorization URL. */ additionalParams?: Record; /** * Optional agent configuration. When provided, the resulting URL is * decorated with `requested_actor=` so the issued user token is * delegated on-behalf-of the agent. */ agentConfig?: AgentConfig; /** * When `true`, the `fidp=OrganizationSSO` query parameter is omitted so the * enhanced organization authentication flow can take over discovery. * Defaults to `false`. */ isEnhancedOrgAuth?: boolean; /** * Optional `resource` query parameter to forward to the authorize endpoint. */ resource?: string; /** * Optional `state` value to seed request correlation with. If omitted, the * underlying SDK generates one. */ state?: string; } declare class AsgardeoJavaScriptClient implements AsgardeoClient { private cacheStore; private cryptoUtils; private auth; private storageManager; private baseURL; private initPromise; constructor(config?: AuthClientConfig, cacheStore?: Storage, cryptoUtils?: Crypto); protected ensureInitialized(): Promise; getDiscoveryResponse(): Promise; switchOrganization(_organization: Organization, _sessionId?: string): Promise; initialize(_config: T, _storage?: Storage): Promise; reInitialize(_config: Partial): Promise; getUser(_options?: any): Promise; getAllOrganizations(_options?: any, _sessionId?: string): Promise; getMyOrganizations(_options?: any, _sessionId?: string): Promise; getCurrentOrganization(_sessionId?: string): Promise; getUserProfile(_options?: any): Promise; isLoading(): boolean; isSignedIn(): Promise; updateUserProfile(_payload: any, _userId?: string): Promise; getConfiguration(): T; exchangeToken(_config: TokenExchangeRequestConfig, _sessionId?: string): Promise; signInSilently(_options?: SignInOptions): Promise; getAccessToken(_sessionId?: string): Promise; clearSession(_sessionId?: string): void; setSession(_sessionData: Record, _sessionId?: string): Promise; decodeJwtToken>(_token: string): Promise; signIn(_options?: SignInOptions): Promise; signOut(_options?: SignOutOptions, _sessionIdOrAfterSignOut?: string | ((afterSignOutUrl: string) => void), _afterSignOut?: (afterSignOutUrl: string) => void): Promise; recover(_payload: EmbeddedFlowExecuteRequestPayload): Promise; signUp(options?: SignUpOptions): Promise; signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise; getAgentToken(agentConfig: AgentConfig): Promise; getOBOSignInURL(agentConfig: AgentConfig): Promise; getOBOToken(agentConfig: AgentConfig, authCodeResponse: AuthCodeResponse): Promise; /** * Builds a `/oauth2/authorize` URL targeting a specific child organization. * * The target organization can be identified by its UUID (`orgID`), handle * (`orgHandle`), display name (`org`) or via email-domain based discovery * (`emailDomain`). * * @param orgDiscoveryType - The organization discovery strategy to use. * @param discoveryInput - The identifier whose meaning depends on * `orgDiscoveryType` (UUID, handle, name or email). * @param options - Optional state, resource, agent delegation and * additional query parameters. * @returns The fully-built authorization URL. */ getOrgAuthorizationUrl(orgDiscoveryType: OrgDiscoveryType, discoveryInput: string, options?: OrgAuthorizationUrlOptions): Promise; /** * Exchanges an existing access token for one scoped to a target organization, * using the `organization_switch` grant type. * * Unlike {@link AsgardeoJavaScriptClient.exchangeToken} this method does * not require an active SDK session — the caller supplies the source * access token directly. This makes it safe to use from server-side agent * flows where there is no user session yet. * * @param token - The current access token to be switched. * @param switchingOrganization - The ID/UUID of the target organization. * @param scopes - Optional list of scopes to request for the switched token. * @returns A normalized {@link TokenResponse} for the switched organization. */ switchTokenToOrganization(token: string, switchingOrganization: string, scopes?: string[]): Promise; /** * Resolves the OAuth2 token endpoint URL. * * Prefers the value advertised by the OIDC well-known document (when it * has already been loaded into the storage manager) and falls back to * `${baseURL}/oauth2/token` derived from the SDK configuration. */ private resolveTokenEndpoint; /** * Authenticates as the agent and switches the issued agent token into a * target child organization in a single call. * * @param agentConfig - Agent credentials used to obtain the parent-org agent token. * @param switchingOrganization - The ID/UUID of the target organization. * @param orgScopes - Optional scopes to request for the organization-scoped token. * @returns A normalized {@link TokenResponse} scoped to the target organization. */ getOrganizationAgentToken(agentConfig: AgentConfig, switchingOrganization: string, orgScopes?: string[]): Promise; /** * Builds the custom query-parameter map for an organization-scoped authorization request. */ private static buildOrgAuthorizationParams; } export default AsgardeoJavaScriptClient; //# sourceMappingURL=AsgardeoJavaScriptClient.d.ts.map