Quick Reference: Retrieve Customer Info ('Me') Cognito
Overview
This guide is a quick reference that lists the steps for accessing the customer information of the currently logged in user. In USTA parlance, this is 'Bound' access. In this mode, the customer UAID is bound to the session under which the user has logged in to USTA.com. The token will restrict access to only data for this one UAID.
Me Construct
When working in Bound mode, 'me' represents the only customer to which you will have access to data. In other words, data that is about the logged in user.
Building Your Application
The following is a quick guide for accessing bound customer data. More on the bound mode can be found on the API Reference page.
It should be noted that the best use of this API is within the context of a browser-based application. Because the customer UAID is bound to the token, it is safe to store in a cookie.
Step 1: Integrate Cognito Login Flow
Please follow the steps for integrating the Cognito Login flow into your application at Login/Sign In, At the end of step 3 on the referenced link, you will have retrieved the JWT Access token after the
customer has logged in.
Step 2: Perform API Operations Using JWT Access Token
Once you have a JWT Access token, you can begin calling Bound API calls. Remember that the customer UAID is bound to the token, and only data associated with that UAID can be retrieved in Bound mode.
For instance, you can retrieve your Customer Profile information using the following API call: https://stage-services/v1/customer/me
Headers
Key | Value |
---|---|
Content-Type | application/json |
authorization | 'Bearer ZTc2ZGQxZWItZjVjMC00MDFiLWFjYTktZWYxZGRlNTcyYzg4OkhOOUU2U2ovdmtWUWEyR2pKYUxBSDF4WndWTzN0dHZWQmJRQnpRaVlpbWc1RWFvVVJ5bUVhTzc4SVRtNVh5NjQzSUo0UThTcHpTNXQ2c2Jz' |
Result
The result shows the account profile for the user associated with the email id requested in the Janrain token in Step 1.
{ "uaid": "2017492001", "firstName": "bat", "lastName": "man", "dateOfBirth": "2018-02-11", "gender": "DND", "wheelchairPlayer": false, "emails": [ { "emailAddress": "bat.man430@mailinator.com" } ], "addresses": [ { "id": "1568772805481", "isPrimary": true } ] }
Example
This example uses CURL from the command line.
curl -X GET \
https://stage-services.usta.com/dev/v1/customers/me \
-H 'Authorization: Bearer eyJhb... \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json'