Most requests made to the API must be authenticated. The API supports 2 schemes for authentication: OAuth and Basic Authentication.
We strongly recommend that you use OAuth. Use basic authentication if you are the only user of your application or if you are an organization account.
Ride with GPS is an OAuth provider, and we recommend that you use OAuth if you plan authenticate users others than yourself. The workflow is secure, and does not require users to share their Ride with GPS password with you.
From the developer settings page of your account, create or update an API client and specify one or more Redirect URIs (redirect_uri) pointing to endpoints you own. Your API client will then be setup for OAuth and its management page will display your OAuth client ID (client_id) and secret (client_secret). Never share those with anyone.
Your application links your user to the authorization web page hosted on the Ride with GPS website:
<a href="https://ridewithgps.com/oauth/authorize
?client_id=[client_id]
&redirect_uri=[redirect_uri]
&response_type=code">
Login on Ride with GPS
</a>
Where:
redirect_uri must match one of the OAuth redirect URIs configured for your API Clientclient_id is the OAuth client ID for your API ClientThe user will be presented with the following interface:

Once the user clicks the Authorize button, they are redirected to redirect_uri with an access grant:
[redirect_uri]?code=[access_grant]
access_grant for an access_tokenUsing the access grant that was sent to your redirect_uri, your application fetches the access_token:
Request
POSThttps://ridewithgps.com/oauth/token.jsonRequest body
{
"grant_type": "authorization_code",
"code": "[access_grant]",
"client_id": "[client_id]",
"client_secret": "[client_secret]",
"redirect_uri": "[redirect_uri]"
}
redirect_uriin request body must match the one used in the first step above.
Example Response
{
"access_token": "Qnpa6Bif4gF9s6uU5YwjtxbaP3UzQxgfArDP7HXZj_5",
"token_type": "Bearer",
"scope": "user",
"created_at": 1725551509,
"user_id": 1
}
user_id is the Ride with GPS assigned id for the user who completed the autorization flow.access_token is the token to use OAuth for authentication:// header
Authorization: Bearer [access_token]
Your application can then make requests on the Ride with GPS API with the Authorization header to authenticate as your user. For example to get more details about the user who just completed the OAuth flow:
GET https://ridewithgps.com/api/v1/users/current.json
// header
Authorization: Bearer [access_token]
Issue the following request to revoke an existing OAuth access token:
Request
POSThttps://ridewithgps.com/oauth/revoke.jsonRequest body
{
"client_id": "[client_id]",
"client_secret": "[client_secret]",
"token": "[access_token]"
}
Example Response
// 200 - OK
{}
The token will then be revoked and cannot be used to authenticate requests anymore
Basic authentication suits the needs of organization accounts and single user applications.
Knowing your email and password, get an authentication token associated with your API key.
Request
POSThttps://ridewithgps.com/api/v1/auth_tokens.jsonx-rwgps-api-key: [api_key]Request body
{
user: {
email: "[your_email]",
password: "[your_password]"
}
}
Example Response
// 201 - Created
{
"auth_token": {
"auth_token": "c0cc78875f250604f9abac97712e314c",
"api_key": "2704a8df",
"created_at": "2024-09-05T05:47:53Z",
"updated_at": "2024-09-05T05:47:53Z",
"user": {
"id": 1,
"email": "bob@example.com",
"name": "Bob",
"created_at": "2024-01-17T01:45:09Z",
"updated_at": "2024-09-04T17:18:52Z"
}
}
}
Unlike user accounts, organization accounts are not setup with an email and password, which prevents them from using the endpoint above to generate authentication tokens.
Instead, to create authentication tokens, administrators of the organisation can:
The page will then display the authentication token and it can be used authenticate the API requests.
You can then authenticate with Basic authentication, using your api_key and auth_token:
// header
Authorization: Basic base64encode("[api_key]:[auth_token]")
Alternatively, you can also authenticate with the following headers:
// headers
x-rwgps-api-key: [api_key]
x-rwgps-auth-token: [auth_token]