// ... /////
$b24 = await initializeB24Frame()
if ($b24.auth.isAdmin) {
// ... ////
}
Getters
isAdmin
get isAdmin(): boolean
Returns true if the current user has admin rights, otherwise false.
Methods
getAuthData
getAuthData(): false | AuthData
Returns authentication data AuthData if it has not expired. If expired, returns false.
refreshAuth
refreshAuth(): Promise<AuthData>
Refreshes authentication data through the parent window and returns the updated data AuthData.
Rejects rather than returning a broken state: JSSDK_FRAME_REFRESH_AUTH_TIMEOUT if the parent window does not answer within 10 seconds, JSSDK_FRAME_REFRESH_AUTH_BAD_RESPONSE if it answers without a usable AUTH_EXPIRES. In both cases the previous token is left untouched, so a retry is meaningful. See Error codes.
Concurrent calls are coalesced: while a refresh is in flight, every further call gets that same promise back rather than sending a second
refreshAuth message to the parent window. This matters because a B24Frame runs two transports (restApi:v2 and restApi:v3) over one AuthManager, and because refreshing too often is what Bitrix warns can get an application blocked automatically. A refresh started after the previous one settled is a real refresh — the coalescing window is only the time one is actually in flight.You rarely need to call this yourself. The SDK refreshes an already expired token before a request — a valid one is used as is, so a call does not cost a refresh — and refreshes again if the portal answers
401. If your app reads the token with getAuthData() and uses it outside the SDK, prefer keepAuthFresh over your own timer.getUniq
getUniq(prefix: string): string
Returns a unique string consisting of the given prefix and AuthData.memberId.
Used in
B24PullClientManager