# How to fix "401 Unauthorized" error

The most common cause for this error is an incorrect Client Secret.

The first thing you should check in this case is if the Client Secret you have provided actually belongs to the defined Client ID.

If it seems to be correct, you should also check if you have provided the Client Secret ID instead of the Client Secret Value.

You can do this by checking the uncensored part of your Client Secret in Email This Issue:

<figure><img src="/files/AKEYno0DJdjQJDLfRZp8" alt=""><figcaption></figcaption></figure>

And see if it matches the beginning and end of the Client Secret ID:

<figure><img src="/files/qbG7fpvy9HK06rLGSEqq" alt=""><figcaption></figcaption></figure>

If it does, please change it for the Client Secret Value. If it appears censored in Azure, you must create a new Client Secret, as these values are only visible once.


---

# 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.meta-inf.hu/email-this-issue/administration/mail-server-connections/microsoft-with-oauth2/troubleshooting-guides-for-microsoft-oauth2-connections/how-to-fix-401-unauthorized-error.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.
