> For the complete documentation index, see [llms.txt](https://docs.tryterra.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tryterra.co/help-center/help-topics/connecting/setting-up-provider-credentials-bring-your-own-keys/whoop-invalid-client-unknown-error.md).

# Why does WHOOP auth fail with unknown\_error after the user approves?

The usual cause is a Client ID or Secret saved in Terra that doesn't match your WHOOP app, so WHOOP rejects the token exchange.

**The usual cause is a Client ID or Secret saved in Terra that doesn't match your WHOOP app.** After the user approves, Terra exchanges the authorisation code with WHOOP using the credentials saved on your WHOOP connection. If WHOOP rejects them, the user is sent to your failure redirect with `unknown_error`.

Causes seen in practice include a secret pasted one character short and a URL pasted into the secret field. Neither is easy to spot by eye.

{% stepper %}
{% step %}
In the [WHOOP Developer Dashboard](https://developer-dashboard.whoop.com/), open your app and copy the Client ID and Client Secret.
{% endstep %}

{% step %}
In the Terra dashboard, open **Connections > Sources > WHOOP** on the environment your users connect through, and paste both values in full, with no leading or trailing spaces.
{% endstep %}

{% step %}
Save, and make sure the save completes. Credentials are saved per environment, so repeat this on each environment you use.
{% endstep %}

{% step %}
Run a new connection. Users whose connection failed need to start the flow again.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
If the redirect URL is the problem instead, WHOOP stops the flow at its own authorisation step, because the redirect URL in the request must match the one registered on your WHOOP app. See [How do I set up WHOOP provider credentials?](https://docs.tryterra.co/help-center/help-topics/connecting/setting-up-provider-credentials-bring-your-own-keys/whoop-byo-credentials-setup)
{% endhint %}
