Authorizing your first request
Let's log in...
To start working with API, you need to get an Access token (authorize your request). In this example we are going to use a GoSpeech account with Developer Test plan to authorize it using resource owner password OAuth 2.0 flow .
At first, we configure the API client in our account:
- Enter App Name, in our example we use
Demo App Client
. - Choose Grant Type, we have decided to select
Resource Owner Password
. - Click Generate button to create a client.
- After the creation, copy generated Client Id and Client Secret. These are necessary for the next steps.
It is time to get an access token. To do this we need to send HTTP request to GoSpeech API, in this example we will use the curl
CLI tool:
curl -X POST "https://auth.app.gospeech.com/connect/token" \
-d "grant_type=password" \
-d "client_id=<your_client_id>" \
-d "client_secret=<your_client_secret>" \
-d "username=<your_account_email>" \
-d "scope=openid offline_access email profile integrated-api"
ScopesTo access GoSpeech API you have to add
integrated-api
scope in your token request. Also you might have to addmanagement-api
scope to use the management API which is necessary for the 2nd scenario.
You have to replace the following placeholders with your values:
<your_client_id>
- your Client Id which you received after client creation.<your_client_secret>
- your Client Secret which you received after client creation.<your_account_email>
- your email address which you used to sign up for GoSpeech.
The request will return response like below in JSON format:
{
"access_token":"<your_access_token>",
"expires_in":3600,
"token_type":"Bearer",
"refresh_token":"<your_refresh_token>",
"scope":"email integrated-api offline_access openid profile"
}
Common errorsIf you get an
error invalid_username_or_password
please review the values for Client Id and Client Secret. Please also check if you have a Developer account. See details in Quick start.
With the acquired access token we can make HTTP-requests to the GoSpeech API. For example, let's get Records from your Worklist using this endpoint. Simply put the access token in the Authorization
HTTP-request header as shown below:
curl -X GET "https://auth.app.gospeech.com/api/records/worklist?offset=0&limit=20" \
-H "Authorization: Bearer <your_access_token>"
Further, you can also test by using our API Reference by just entering the access token in the authorization section.
Updated 7 months ago