import { AuthenticationStrategy } from '@wix/sdk-types'; export type AppStrategy = AuthenticationStrategy & { getInstallUrl(opts: { redirectUrl: string; state?: string; token?: string; }): string; handleOAuthCallback(url: string, opts?: { state: string; }): Promise<{ instanceId: string; accessToken: string; refreshToken: string; }>; /** * Return a new instance of the AppStrategy which uses an elevated access token */ elevated(): Promise; /** * Returns infromation about the active token */ getTokenInfo(): Promise<{ active: boolean; subjectType: 'APP' | 'USER' | 'MEMBER' | 'VISITOR' | 'UNKNOWN'; subjectId: string; exp: number; iat: number; clientId?: string; siteId: string; instanceId?: string; }>; }; /** * Creates an authentication strategy for Wix Apps OAuth installation process. * Use this authentication strategy when making requests to Wix APIs from your Wix App backend. * @param opts Options for initializing the authentication strategy * @param opts.appId The Wix App ID * @param opts.appSecret The Wix App Secret * @param opts.refreshToken An optional refresh token previously retrieved from Wix OAuth API * @param opts.instanceId An optional instance ID of the Wix App instance the client is making requests on behalf of * @param opts.accessToken An optional access token previously retrieved from a client Wix Extension * @param opts.publicKey An optional public key for validating webhook requests (supports both PEM and base64 encoded keys) * @returns An authentication strategy that can be used with WixClient * @example * ```ts * import { AppStrategy, createClient } from '@wix/sdk'; * import { products } from '@wix/stores'; * * const client = createClient({ * auth: AppStrategy({ * appId: 'appId', * appSecret: 'appSecret', * }), * modules: { products }, * }); * * const installUrl = client.auth.getInstallUrl({ redirectUrl: 'https://example.com' }); * // Redirect the user to the installUrl * * ... * * // in the callback handler of your http server * // req.url is the url of the callback request * const { instanceId, refreshToken } = await client.auth.handleOAuthCallback(req.url); * * // store the instanceId and refreshToken in your database * // use the authorized client * const products = await client.products.queryProducts().find(); * * ``` */ export declare function AppStrategy(opts: { appId: string; appSecret?: string; publicKey?: string; authServerBaseUrl?: string; } & ({ refreshToken?: string; } | { instanceId?: string; } | { accessToken?: string; })): AppStrategy;