# Authentication

## How it works

IDC uses one of two authentication methods to securely connect to Lightspeed X-Series. With either method, your connection credentials are encrypted and stored safely in NetSuite — IDC never stores them in plain text.

**Personal Token method:** You provide a long-lived token from Lightspeed admin settings. IDC uses this token directly to authorize API requests. This token remains valid until you revoke it in Lightspeed.

**OAuth method:** You provide Client ID, Client Secret, and a Refresh Token. IDC exchanges these credentials for a short-lived access token, which it uses to make API calls. When the access token expires, IDC automatically refreshes it using your Refresh Token — this happens behind the scenes with no action needed from you.

## When credentials expire

* **Personal Token:** Does not expire unless you manually revoke it in your Lightspeed X-Series admin settings.
* **OAuth tokens:** The Access Token is short-lived (typically 1 hour), but IDC renews it automatically. The Refresh Token lasts longer and is used only to get new access tokens. If the Refresh Token expires or is revoked, you'll need to re-authorize.

## Re-authorizing

If your connection stops working, you'll see a red "Failed" badge on the Lightspeed X-Series app. Here's how to fix it:

1. In the IDC dashboard, click **Apps** in the left menu.
2. Click **Lightspeed X-Series** to open the app.
3. Click **Connect** or **Credentials**.
4. If you used a Personal Token, re-paste it. If you used OAuth, re-enter your Client ID, Client Secret, and Refresh Token.
5. Click **Save**. IDC will test the connection immediately.
6. If the test passes, you'll see a green confirmation. Syncs can now resume.

## Common authentication issues

| Symptom                                                                    | What to try                                                                                                                                                               |
| -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| "Connection failed" error after saving credentials                         | Verify that your credentials are correct in Lightspeed X-Series admin settings. Copy and paste them carefully to avoid typos.                                             |
| Flows were running but now show "Authorization failed" in the activity log | Your Personal Token may have been revoked, or your OAuth Refresh Token may have expired. Go to Credentials and re-enter your tokens.                                      |
| Can't find Client ID or Client Secret in Lightspeed settings               | Make sure you're in the admin account with API integration permissions enabled. Check with your Lightspeed account manager if you don't see the API Integrations section. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.in8sync.com/idc/lightspeed-x-series/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
