Get Data for OAuth 2.0 BX24.getAuth

If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.

BX24.getAuth(): boolean|object;
        

The function BX24.getAuth retrieves the current authorization data via the OAuth 2.0 protocol. It returns an object in the following format:

{
            access_token: "cd4b8566006efd82005fdecc000000007dccbb3dcc7411d1e5878338535115c7e",
            domain: "b24.yurta.bx",
            expires_in: 1720011727002,
            member_id: "42bc01fbd89dd1d45d13506933f6f4fc",
            refresh_token: "bdc"
        }
        

The expiration date is provided as a date object.

It only works after BX24.init. If called before the application is initialized or after the token has expired, it will return false. When the token expires, a new one is automatically generated on the next call to BX24.callMethod or BX24.refreshAuth.

No parameters required.

Example

document.addEventListener("DOMContentLoaded", function() {
            BX24.init(() => {
                const authInfo = BX24.getAuth();
                console.log('B24: authInfo: ', authInfo);	
            });
        });
        

How to Use Examples in Documentation

Continue Learning