The information in this document can help troubleshoot issues that you might
encounter while you implement **Subscription Linking**.

> [!TIP]
> **Tip:** Open the JavaScript console and look for error messages from the `swg.js` client library. This can help you identify potential issues in your implementation.

## Subscription Linking CTA stuck on loading screen

Error example:

![Loading symbol](https://developers.google.com/static/news/subscription-linking/implementation/images/sl-cta-stuck.png)

**Figure 1.** Subscription Linking CTA doesn't load.

To resolve this issue, check the following:

- Make sure that you add the origins of the pages, including testing subdomains, as [additional URLs](https://support.google.com/news/publisher-center/answer/13543753) in the publication settings of Publisher Center.
  - Make sure the status of the URL is "Verified" instead of "Verify".
- For Extended Access or Reader Revenue Manager Enterprise implementations, make sure that you add the origins of the pages, including testing subdomains, to the [authorized JavaScript origins](https://support.google.com/cloud/answer/6158849#zippy=%2Cauthorized-domains) of the OAuth 2.0 Client you configured for such implementation. This needs to be done in Google Cloud Console.

> [!NOTE]
> **Note:** If you've recently added the origins, it can take up to an hour before such origins can access the `swg.js` client library.

## Account couldn't be linked

Error example:

![Account couldn't be linked](https://developers.google.com/static/news/subscription-linking/implementation/images/account-couldnt-link.png)

**Figure 2.** Account couldn't be linked issue.

To resolve this issue, check the following:

- Make sure to accept the **Terms of Service for Subscription Linking** in the **Publisher Center** . To do so, go to the **Subscription Linking** settings and click **sign the subscription linking terms of service**.
- If the Google Account has already been linked, you'll get an error message when you reattempt to link the subscription. You must unlink the subscription, through the [subscriptions
  page](https://myaccount.google.com/subscriptions) in Google Account, before you repeat the client-side integration test.

## Permissions error when calling the Subscription Linking API

Error example:

|---|---|
| Code | `403` |
| Message | `'readerrevenuesubscriptionlinking.readerEntitlements.update'` denied on resource ` '//readerrevenuesubscriptionlinking.googleapis.com/publications/example.com/readers/10078823/entitlements'` (or it may not exist)." |

To resolve this issue, check the following:

- Make sure that you use the same project as specified in the [Subscription Linking setup](https://support.google.com/news/publisher-center/answer/13543753). When you set up Subscription Linking in the Publisher Center, use the [**Project number**](https://cloud.google.com/resource-manager/docs/creating-managing-projects). You can locate the **Project number** from your [project dashboard](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects).
- Make sure that [Subscription Linking API](https://console.cloud.google.com/apis/library/readerrevenuesubscriptionlinking.googleapis.com) is enabled in your project.
- In the project Identity and Access Management (IAM), make sure that the service account is [granted with the role](https://developers.google.com/news/subscription-linking/implementation/synchronize-user-entitlements) as **Subscription Linking Admin**. Note that the role change propagation through the system might take time. If you receive a 403 error when making API calls, even after you confirm that your service account has the correct IAM role, wait for a few moments and then try your request again.
- If you are unsure which service accounts to use or whether they've the
  necessary IAM role, use the
  [Policy Analyzer](https://cloud.google.com/policy-intelligence/docs/analyze-iam-policies#principal-query-all)
  from the project that you set up for Subscription Linking. Create and run a
  custom query with the following query parameters:

  | Parameter 1 | Role |
  |---|---|
  | Role | Subscription Linking Admin |

- Make sure that you use the correct service account key when you call the
  Subscription Linking API. Inspect the following properties in your service
  account key (JSON file):

  - **type:** It must be service_account.
  - **project_id:** It must be the **Project ID** of the **Project number** specified in the Subscription Linking setup.

    > [!NOTE]
    > **Note:** **Project ID** and **Project number** are two different identifiers that you can locate from your [project dashboard](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects).

  - **client_email:** It must be the same service account in project IAM that's assigned with the role **Subscription Linking Admin**.
- If you obtained the access token through Google OAuth 2.0 token endpoint
  (https://oauth2.googleapis.com/token), make sure that the token is valid and
  not expired when you call Subscription Linking APIs. If the token expires,
  you have to obtain a new one.

- If you use the REST API, make sure that you use the **Publication ID** you
  provided in the **Subscription Linking** setup. For example, if your
  Publication ID is `example.com`, then the request URL must contain it.

  - ✅ Use only the configured Publication ID: `publications/example.com/readers/10078823/entitlements`
  - ❌ Don't use Publication ID other than the one specified in **Subscription Linking** configuration: `publications/example-staging.com/readers/10078823/entitlements`
  - ❌ Don't include the publication product in the request: `publications/example.com:premium/readers/10078823/entitlements`

> [!NOTE]
> **Note:** It might take several minutes or longer for the permission change in IAM to take effect. For more information, see [Access change propagation](https://cloud.google.com/iam/docs/access-change-propagation).

## Invalid argument error when updating the entitlement

Error example:

|---|---|
| Message | Error: Request contains an invalid argument |

To resolve this issue, check the following:

- Make sure that you provide the `entitlements` object in the correct format. See this [example](https://developers.google.com/news/subscription-linking/api/methods#request_3).
- Make sure that `product_id` is in the format of `publication_id:product`.
  - ✅ Valid example: `"product_id":"example.com:basic"`
  - ❌ Invalid example: `"product_id":"example.com"`

## Not seeing articles highlighted in the search results

To resolve this issue, check the following:

- Make sure to add the [structured data](https://developers.google.com/news/subscription-linking/implementation/structured-data) to all your articles. Use the [Rich Results
  Test](https://search.google.com/test/rich-results) to validate your structured data.
- Make sure that you put a valid `productID` in the structured data that corresponds to a set of Product IDs you use to [update reader's
  entitlement](https://developers.google.com/news/subscription-linking/api/methods#updatereaderentitlements).
- Use a [rich result report](https://support.google.com/webmasters/answer/7552505) for "subscribed content" in **Search Console** to see any issues related to your structured data.

> [!NOTE]
> **Note:** There are ranking factors involved when we display the **From Your
> Subscriptions** feature. This means it isn't always guaranteed that you see your news article for any given search term.

## Cannot change the Subscription Linking call to action message language

![Subscription Linking call to action](https://developers.google.com/static/news/subscription-linking/implementation/images/link-your-subscription.png)

The Subscription Linking call to action language is determined
by the user's settings. It cannot be globally overridden.

The language is determined as follows:

1. If the user is logged in with their Google Account, the primary language set in their Google Account settings (<https://myaccount.google.com/language>) is used.

2. If the user is not logged in, the language is based on either their browser's or operating system's primary language setting.

Subscription Linking call to actions don't support all languages.
If a user's primary language is not supported, the call to action may default
to English.