When your application makes requests that need identifying the user's Google Account. It must include an authorization token. The token also identifies your application to Google.

### About authorization protocols

You must use [OAuth 2.0](https://developers.google.com/accounts/docs/OAuth2) to authorize requests.

<br />

> [!WARNING]
> OAuth 1.0 is not supported. If your application uses OAuth 1.0, you must migrate to OAuth 2.0 to use this API.

<br />

### Authorize requests with OAuth 2.0

Following endpoints provided by Payments Reseller Subscription API must be authorized by an authenticated user.

- [partners.subscriptions.create](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.subscriptions/create)
- [partners.subscriptions.entitle](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.subscriptions/entitle)
- [partners.promotions.findEligible](https://developers.google.com/payments/reseller/subscription/reference/rest/v1/partners.promotions/findEligible)

The following general process applies in the OAuth2 flow:

1. When you create your application, you register it using the [Google API Console](https://console.developers.google.com/). Google then provides information you'll need later, such as a client ID and a client secret.
2. When your application needs access to user data, it asks Google for a particular scope of access.
3. Google displays an OAuth dialog to the user, asking them to authorize your application to request some of their data.
4. If the user approves, then Google gives your application a short-lived access token.
5. Your application requests user data, attaching the access token to the request.
6. If Google determines that your request and the token are valid, it returns the requested data.

### Accepted OAuth 2.0 Scopes

#### Sensitive OAuth 2.0 scopes

| Google Services | Scope | Applicable APIs |
|---|---|---|
| Google Home | `https://www.googleapis.com/auth/home.platform.selected.devices` | \[partners.subscriptions.create\](/payments/reseller/subscription/reference/rest/v1/partners.subscriptions/create), \[partners.subscriptions.entitle\](/payments/reseller/subscription/reference/rest/v1/partners.subscriptions/entitle) |
| Google One | `https://www.googleapis.com/auth/subscriptions.thirdparty.googleone` | \[partners.subscriptions.create\](/payments/reseller/subscription/reference/rest/v1/partners.subscriptions/create), \[partners.subscriptions.entitle\](/payments/reseller/subscription/reference/rest/v1/partners.subscriptions/entitle) |
| Google Play Pass | `https://www.googleapis.com/auth/googleplay.pass.paymentsreseller` | \[partners.subscriptions.create\](/payments/reseller/subscription/reference/rest/v1/partners.subscriptions/create), \[partners.subscriptions.entitle\](/payments/reseller/subscription/reference/rest/v1/partners.subscriptions/entitle) |
| YouTube | `https://www.googleapis.com/auth/youtube.commerce.partnership.integrated-billing` | \[partners.subscriptions.create\](/payments/reseller/subscription/reference/rest/v1/partners.subscriptions/create), \[partners.subscriptions.entitle\](/payments/reseller/subscription/reference/rest/v1/partners.subscriptions/entitle) |

Note that using the sensitive scopes in the production requires a [formal review](https://developers.google.com/identity/protocols/oauth2/production-readiness/sensitive-scope-verification).

To request access using OAuth 2.0, your application needs the scope information, as well as information that Google supplies when you register your application (such as the client ID and the client secret).

### OAuth Refresh Tokens

If your application needs access to Payments Reseller Subscription API beyond the lifetime of a single access token, it can obtain a refresh token. A refresh token allows your application to obtain new access tokens.

<br />

> [!NOTE]
> Using refresh token is not required and may introduce extra complexity to your system.

> [!NOTE]
> A sample use case: by storing the refresh token in your system, and as long as the refresh token remains valid, your application can upgrade or downgrade a subscription without needing to guide the end user through another consent flow.

<br />

A refresh token typically expires in 6 months. While you can periodically refresh the tokens before they expire, there are other common [scenarios](https://developers.google.com/identity/protocols/oauth2#expiration) where they can become invalidated. You should always take the end user to the consent flow when that happens.