Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

When & How to Use Vendor Services

...

The user will log in and be presented with a message asking them to allow you to perform Betfair calls on their behalf, as shown below.

 

Info

Should they accept this message, they will be redirected to your site (using your redirect URL + any optional parameters). Critically, we will include an 

...

authorization code as a parameter, under the parameter name "code".

NOTE: The authorization code will be valid for a single use for 10 minutes.

 

Example redirect

 

Info

You will need to propagate this code to your back-end, from which you will have to exchange it for an access token. The access token will allow you to use the Betfair API on the user's behalf.

To obtain it, you will need to call the token operation on the Accounts API.

 

Example Token request

The token call takes the following parameters:

...

  • access_token: the access token, used to call Betfair on the user's behalf 
  • token_type: meta data for the access token (see 'Making calls on the user's behalf') 
  • expires_in: how long the access token will be valid for (in seconds)
  • refresh_token: a token that can be used to create a new access token (see 'Using the refresh token')
  • application_subscription: contains the vendor client ID, a unique identifier for a user. Can also contain some subscription related information (See 'Legacy Subscriptions')

IMPORTANT

 

To protect sensitive information such as your app key and secret, it is important that the token operation only be called from server to server.

Example Token request - REST

...

 

{"access_token":"KeOi+kyg2RvDK4HM+W46CvSnP5w=","refresh_token":"50d76117-7f85-375v-a38f-ffb332713f93","application_subscription":{"vendor_client_id":"456238"},"token_type":"BEARER","expires_in":"14400"}

 

 
You can user the 'expires_in' value to determine when the access token will stop being valid. Alternatively, if calls made with the access token start returning an INVALID_SESSION error, it is likely that the token has expired.

...