Get Data for OAuth 2.0 BX24.getAuth
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
- Initialize the BX24.init Library
- Handle the first launch event of the application by the user BX24.install
- Notify about the completion of the installer BX24.installFinish
- Force Update Authorization Key BX24.refreshAuth
Copied