Authorize (authorize)

Authorize current WebSocket session to act on behalf of the owner of a given token. Must precede requests that need to access client account, for example purchasing and selling contracts or viewing portfolio.

authorize(authorize: str, add_to_login_history: Optional[int] = None, passthrough: Optional[Any] = None, req_id: Optional[int] = None) → int
Parameters:
  • authorize (str) – Authentication token. May be retrieved from https://www.binary.com/en/user/security/api_tokenws.html
  • add_to_login_history (Optional[int]) – [Optional] Send this when you use api tokens for authorization and want to track activity using login_history call.
  • passthrough (Optional[Any]) – [Optional] Used to pass data through the websocket, which may be retrieved via the echo_req output field.
  • req_id (Optional[int]) – [Optional] Used to map request to response.
Returns:

req_id

Return type:

int

Example

binary.api.authorize(
    'uw2mk7no3oktoRVVsB4Dz7TQncfABuFDgO95dlxfMxRuPUDz'
)