Apps for multiple users (OAuth2 Access Code Flow)

Is this the right flow for you?

Before you get started, let's make sure this is the right approach for you. Learn more at: How should I authenticate?

Let's get started

OAuth2 is a protocol that lets external apps request authorization from Reverb to perform actions on behalf of a user without storing the user's password on the app. Users can allow apps to perform specific types of operations (for example, read vs update data), and can revoke access at any time, making this a secure and convenient way to integrate.

All apps need to be registered first

A registered OAuth application is assigned a unique Client ID and Client Secret. The Client Secret should not be shared.

OAuth2 is Standard - Don't roll your own implementation

The flow below outlines the specifics of what happens, but you should be able to take an off the shelf oauth2 library for your platform. Here are a few existing ones:

See the full list of available oauth2 clients

The code below will show the basic actions required to complete the OAuth2 Authorization Code Flow which involves obtaining a code and then posting it back to Reverb to get a Bearer Token.

1. Redirect users to Reverb to request access.

Your app should provide a button with the title "Login with" or similar. This button should link to the following url:[your-client-id]&redirect_uri=[your-callback-url]&response_type=code&scope=read_listings+write_listings"

Explanation of params:

Param Name





Required. The client ID is a unique id assigned to your application when you register it with Reverb. View your ClientID at by clicking the details link for your app.



Required. The URL where Reverb will redirect once the user authorizes your app. This should look something like



Optional. A list of oauth scopes that your application requires on the user's behalf. The list is delimited by spaces, which is URI encoded as +. For example, an app that wants to read the user's listings and update them should use the scope: read_listings+update_listings. By default you will only get read access to the user's information.

List of all OAuth Scopes



Required. Should be set to code. No other values are supported.



Optional. This parameter will be delivered back to you during the redirect. You should use this to set a randomly generated unguessable string so that you can validate the request for additional security in step 3.

2. User authorizes application

The user will be presented with a screen that looks similar to this:


3. User is redirected back to your redirect_uri with a code

The user's browser will be redirected back to your site with a temporary code. The url will look something like this:

If you supplied a state parameter in step 1, this is a good time to validate that the state you got back is the same as you requested. If it's not, the request originated with a third party and should be ignored. Read more about CSRF protection with the state parameter.

4. You request a token from Reverb

To request a token from reverb, you will POST to the url with the following parameters.

curl -XPOST -d "client_id=[...]&client_secret=[...]&code=[...]&grant_type=authorization_code&redirect_uri=[...]"

The response will contain an access token:

{"access_token":"7ef5a3d9a01290e61449542e2033f76a84236b7902dfe8dee9278b73eee71db4","token_type":"bearer","scope":"update_listings read","created_at":1444505942}%

5. Use the token in subsequent requests to Reverb

Now you should set your client's headers to contain the given token in the Authorization header in every API request you make, using the OAuth Bearer token format:

curl -XGET -H "Authorization: Bearer 7ef5a3d9a01290e61449542e2033f76a84236b7902dfe8dee9278b73eee71db4"