Skip to main content

Interface: IAuthService

Defined in: src/types/services.ts:27

Authentication service injected into the runtime.

Remarks

Replaces useAuthContext() from @picsart/growth-rc.

Methods

getHeaders()

getHeaders(): Record<string, string>

Defined in: src/types/services.ts:29

Get current auth headers (e.g., Authorization: Bearer ...)

Returns

Record<string, string>


getRefreshedHeaders()

getRefreshedHeaders(): Promise<Record<string, string>>

Defined in: src/types/services.ts:32

Get refreshed auth headers (re-fetches token if needed)

Returns

Promise<Record<string, string>>


getStatus()

getStatus(): IAuthStatus

Defined in: src/types/services.ts:35

Get current auth status

Returns

IAuthStatus


getUser()?

optional getUser(): IContextUser | null

Defined in: src/types/services.ts:53

Get current user info

Returns

IContextUser | null


onRedirect()

onRedirect(payload?): void

Defined in: src/types/services.ts:50

Open the host's login flow (modal on cookie-SSO hosts, full-page auth-service redirect on SSO-PKCE hosts).

Only for explicit login requests (the miniapp's openAuthScreen). Never wire it to the platform SDK's onAuthRedirect loader option — that hook fires while the SDK is navigating to a miniapp-requested external OAuth provider, and a login redirect started there cancels the provider navigation.

Parameters

payload?

IOpenAuthScreenPayload

The miniapp's openAuthScreen payload, forwarded as-is. Optional so existing implementations that ignore it keep working.

Returns

void


signout()?

optional signout(): void

Defined in: src/types/services.ts:56

Sign out the current user and clear the session

Returns

void