@todo fix me!
v1.0.1
  • Get Started
  • Templates
  • GitHub
  • Overview
  • B24Hook
  • Methods
  • callMethod
  • callFastListMethod
  • fetchListMethod
  • callBatch
  • callBatchByChunk
  • getTargetOrigin
  • getTargetOriginWithPath
  • getLogger
  • setLogger
  • destroy
  • getHttpClient
  • offClientSideWarning
  • Getters
  • auth
  • isInit
  • b24ui
  • b24icons
v1.0.1
  • Docs
  • Frame
  • Hook
  • OAuth
  • Templates

B24Hook.auth

Use B24Hook.auth to retrieve authentication information. Works only in server environment.
B24Hook
TypeB24
AuthHookManager
B24Hook (Webhook) is not safe for client-side use — keep and use it only on the server

Usage

get auth(): AuthActions

Returns an instance AuthHookManager that implements the AuthActions interface, which contains methods for handling authorization operations.

Example

// @todo

import { B24Hook, LoggerFactory } from '@bitrix24/b24jssdk'

// Define the dev mode
const devMode = typeof import.meta !== 'undefined' && (import.meta.env?.DEV || import.meta.dev)

const $logger = LoggerFactory.createForBrowser('MyApp', devMode)
const $b24 = B24Hook.fromWebhookUrl('https://your_domain.bitrix24.com/rest/1/xxxx/')

$logger.info('isAdmin', { isAdmin: $b24.auth.isAdmin }) // true
// @todo
/**
 * Interface for updating authorization
 */
interface AuthActions {
  getAuthData: () => false | AuthData
  refreshAuth: () => Promise<AuthData>
  getUniq: (prefix: string) => string
  isAdmin: boolean
}

Next Steps

Core API methods:

  • callMethod() — Call any REST API method
  • callBatch() — Batch execution of up to 50 commands

Working with lists:

  • callFastListMethod() — Automatic retrieval of all list pages
  • fetchListMethod() — Incremental loading of large lists via generator

Advanced scenarios:

  • callBatchByChunk() — Batch execution of any number of commands with automatic chunking

offClientSideWarning

Disables warning about front-end query execution. Works only in server environment.

isInit

Use B24Hook.isInit to retrieve initialization state information. Works only in server environment.

On this page

  • Usage
  • Example
  • Next Steps
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24