# Authenticate

## Request

POST to the following URL

```
POST https://loginwithlink.com/api/authenticate
```

Include:

* The \`client\_secret\` you received in step 1 (lookup).
* The \`email\` of the consumer.
* The six-digit code they have entered.

## Response

### If six-digit code is correct

We'll return a user object along with `` `authenticationSuccessful: true` ``&#x20;

```json
// if user code is correct
{ authenticationSuccessful: true,
  user: {
    email: "m@rkmoriarty.com"
  }
}
```

If you've been pre-approved, and if the user has such information saved, the user object may be enhanced with additional information:

```json
{ authenticationSuccessful: true,
  user: {
    email: "m@rkmoriarty.com",
    fullName: "Mark Moriarty",
    city: "San Francisco, California 94114",
  }
}
```

### If the six-digit code is not correct:

We'll return `` `authenticationSuccessful: false` `` along with an an error message.

```json
{ authenticationSuccessful: false,
  errorMessage: "m@rkmoriarty.com"
}
```


---

# 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.loginwithlink.com/use-api-only/authenticate.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.
