# authorize

abstract fun authorize(token: String, locationId: String?, callback: Callback<AuthorizeResult>): CallbackReference

Asynchronously authorizes Mobile Payments SDK with an OAuth Access Token and Location ID. Applications must authorize Mobile Payments SDK before performing any other operations.

If authorization completes successfully, the callback will be called with a AuthorizedLocation object containing information about user's location. In case of failure, error description would contain an AuthorizeErrorCode.

This method must be called from the main thread. It should always be given an authorization token and a location identifier.

#### Return

a CallbackReference handle to remove the callback later.

#### Parameters

token

An authorization token. Preferably either the web OAuth token or a Mobile Authorization Code, but it is possible to use a Personal Access Token instead.

locationId

The identifier of the location which will be associated with payments processed via the SDK. It is valid to pass null here when using a Mobile Authorization Code, but a non-null value is required for other token types.

callback

Adds a callback to handle the result of an authorization attempt. The callback is executed on the main thread.