# Logging Users Into The Heat Platform

Users can be logged into the Heat Platform through a custom authentication flow that proves ownership of a wallet address

### Current Supported Chains

| Chain ID | Chain Name     |
| -------- | -------------- |
| 80001    | Polygon Mumbai |

### Login Flow

**Note**: This login flow assumes you can interface with a wallet to sign messages

There are two methods for logging a user into the Heat Platform. First is to use a version of the Amazon Amplify library to login. The second is to send a few manual requests in lieu of using the Amazon provided libraries

**Manual Steps**

**Note**: Responses will be returned in base64 encoding

1. Request a challenge message to sign

Make a request to \`<https://cognito-idp.us-west-1.amazonaws.com/>\` with a JSON body matching below.

Username is in the format `{chainID}-{walletAddress}` with `chainID` being the id of the chain you wish to login with and `walletAddress` being the 0x prefixed wallet address

```json
{
    "AuthFlow":"CUSTOM_AUTH",
    "ClientId":"75k724tms8ge8aqg5sdmhm7s1n",
    "AuthParameters":{
        "USERNAME":"{chainID}-{walletAddress}"
    },
    "ClientMetadata":{}
}
```

2\. Sign the message that is returned from the challenge response

A response will be returned with a message to sign in the challenge parameters

Example:

```json
{
    "ChallengeName": "...",
    "ChallengeParameters": {
        "USERNAME": "{chainID}-{walletAddress}",
        "message": "I am signing my one-time nonce: ####",
    },
    "Session": "...", <- Will need this for challenge response!
}
```

3\. Send signed message as challenge response

Example:

```json
{
    "ChallengeName": "...",
    "ClientId":"75k724tms8ge8aqg5sdmhm7s1n",
    "ChallengeResponses": {
        "USERNAME": "{chainID}-{walletAddress}",
        "ANSWER": "0x...",
    },
    "Session": "...", <- Same as returned above
}
```

4\. Access tokens are returned

Once you receive these Oauth 2.0 tokens they can be securely stored, and can be used to access the Heat Platform as an authenticated user

```json
{
    "AuthenticationResult": {
        "AccessToken": ...,
        "ExpiresIn": ...,
        "idToken": ...,
        "RefreshToken": ...,
        "TokenType": "Bearer",
}
```


---

# 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.heat.tech/for-partners/already-a-partner/logging-users-into-the-heat-platform.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.
