# Login

This section walks you through testing the Violet APIs. Make sure you have already signed up at channel.violet.io/signup and created an application in the previous step. If you haven't, please go through Create a Violet Application.

{% hint style="info" %}
You will need your App ID and App Secret in order to complete this step.
{% endhint %}

### Login

This API tests your connection to Violet by logging into your Application. Add `X-Violet-App-Id` and `X-Violet-App-Secret` added to your headers for login. These are available from the application you created on channel.violet.io. Every request after login will require these header params for authentication, along with the `X-Violet-Token` that you get from login and refreshing your token.

{% hint style="info" %}
While your username and password will be the same across environments (test and live) as will your `X-Violet-App-Id`, this is **not** true for your `X-Violet-App-Secret`.

The `X-Violet-App-Secret` you retrieve from the Channel dashboard is *different* depending on the live/test mode toggle. You must use the correct app secret that corresponds to the environment you are trying to login to: `test` for `sandbox-api.violet.io` and `live` for `api.violet.io`.
{% endhint %}

In addition to the headers mentioned above, include your `username` (your username is the email you signed up with) and `password`. If successful, an access token will be returned in the response body for use in additional requests against the API along with information about your API.

{% hint style="warning" %}
While the User Management feature of the Dashboard allows multiple users to login and view the dashboard,\
only an App's "Owner" username and password will allow you to generate a token.\
You can view who your App's owner is on the [team view](https://channel.violet.io/settings/team)
{% endhint %}

{% openapi src="<https://2435497985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZrOgj5n6PuU2r0Ya8Tzl%2Fuploads%2Fgit-blob-5782768a50b43c2939cce29a226b4ae76acf1c0b%2Fuser-service.yaml?alt=media&token=6f037458-5e94-48ab-a3d9-57acb6a9d4e3>" path="/login" method="post" expanded="true" %}
[user-service.yaml](https://2435497985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZrOgj5n6PuU2r0Ya8Tzl%2Fuploads%2Fgit-blob-5782768a50b43c2939cce29a226b4ae76acf1c0b%2Fuser-service.yaml?alt=media\&token=6f037458-5e94-48ab-a3d9-57acb6a9d4e3)
{% endopenapi %}

**Refresh your Token**

Use the Refresh Token to get a new token. This is an operation you will have to do on a regular basis. You can use your App Id and App Secret with a refresh token to get a new token. This saves the step of having to send your username and password each time to get a new token.
