There are 3 main steps to integrate Smartcar into your application to make API requests to vehicles:

  1. Launch Connect to get consent from the vehicle owner
  2. Fetch an access token
  3. Make a request to the vehicle

The architecture that’s right for you

Smartcar Connect is Smartcar’s OAuth 2.0 authorization flow. It is your users’ first and only touchpoint with Smartcar. After a user enters the Smartcar Connect flow and authorizes their vehicle(s), your application is able to make requests to the Smartcar API. Those requests allow your application to retrieve information and send commands to the user’s vehicle(s), such as reading the odometer and unlocking the doors.

Depending on your web or mobile application architecture, you can implement the Smartcar Connect flow in different ways.

1

User launches Connect

Using the Smartcar iOS SDK or the Smartcar Android SDK, your application launches Smartcar Connect in a browser view. The user logs in with the username and password of their vehicle’s connected services account and grants your application access to their vehicle.

2

User logs in to their vehicle's connected services account

The browser view gets redirected to a special custom-scheme REDIRECT_URI. For more details on how to configure a custom-scheme REDIRECT_URI, see our API reference.

3

Smartcar redirects the user back to your application

Once the user has completed the Smartcar Connect flow, the completion handler in the iOS or Android SDK is invoked with the authorization code.

4

Call your back-end service

Your mobile application sends the authorization code to its back-end service.

5

Fetch your first tokens

In order to exchange the authorization code for an ACCESS_TOKEN, your application makes a request to the Smartcar API. This request must contain the authorization code along with your application’s CLIENT_ID and CLIENT_SECRET.

6

Store your tokens

In response, Smartcar returns an ACCESS_TOKEN and a REFRESH_TOKEN. These should be stored in your application’s database.

7

Make an API request

Using the ACCESS_TOKEN, your application can now make API requests to the user’s vehicle.

Let’s get building

Now you have an idea of how Smartcar works, take a look at one of our Getting Started guides in the tutorials section to get connected to a vehicle.