Header Params

Name Type Required? Description
Authentication Bearer <token> Yes Use your API secret as the token in the hader, use only https

Body Params

Parameters should be sent as x-www-form-urlencoded.

Name Type Required? Example Value Description
app_id uuid Yes APPX-ABC123456 The id of the application that has been created in the platform
client_id uuid Yes CLNT-ABC123456 The id that represents your account
end_user_phone_number E164 Phone Number Yes +14151002000 The phone number of your user that you are generating a session for
end_user_client_id uuid Yes 00a2c280-f87c-47de-a9aa-a210df74fb92 This is an id that is unique to your application that represents this user for this account
Note: This is required as some websites/apps allow multiple accounts, if not you can just pass in anything as long as you consistently use the same value for the same user.
redirect_uri URL Yes https://yourbusiness.co/account/login? The page that you want to redirect to after successful login, note OnlyAuth will append ‘token=VALUE’ at the end
language ISO 639-1 language code Yes en-us Display language of the text on the OnlyAuth Widget
Note: This is a forward-looking parameter, and today does not change the behavior in the widget
region Region Code Yes us-1 The region you wish to use for the widget
Note: This is a forward-looking parameter, and today does not change the behavior in the widget

Responses

Response Type Response Body
200 application/json {
"token": "JWT TOKEN"
}
400 application/json {
"error": "Invalid Request",
"errors": [
"'language' is required.",
"'redirect_uri' is required."
]
}
401 application/json {
"error": "Invalid auth token."
}

Code Examples

Request

import requests

url = "<https://api.onlyauth.io/server/access-tokens/new>"

payload = 'redirect_uri=http%3A%2F%2Fexample.com&language=en-us&end_user_phone_number=%2B14155555555&app_id=APPX-3582f876-b145-45a9-986c-f2a&end_user_uuid=101&region=us-1&client_id=CLNT-841305dd-d7de-420d-8b6c-371acbfedd36'
headers = {
  'Content-Type': 'application/x-www-form-urlencoded',
  'Authorization': 'Bearer 2b50934504a192dee3ed52a8e20392de9edfc780ac98'
}

response = requests.request("POST", url, headers=headers, data=payload)

jwt = response.json().get('token')