> For the complete documentation index, see [llms.txt](https://docs.metaproprotocol.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metaproprotocol.com/developer-documentation/onboarding-the-web3-player/how-to-get-authorization-data.md).

# How to Get Authorization Data

First, you need to know How to Get Authorization Data. This is one of the most important things responsible for logging the user into the Blockchain. Authorization capabilities will be required for integrating the MetaPro Wallet and also for executing certain API queries or displaying user-specific information.

## **Ethers package installation**

In order to authorize, it is required to generate the signature. It can be achieved by using an ethers package.

```bash
npm install --save-dev ethers
```

Then validate if, in the package.json file, dependency is added

```json
"dependencies": {
    "ethers": "^6.7.0"
  }
```

## **Generate signature**

To generate the signature, please implement the following function

```typescript
async function generateSignature() {
  const walletAddress = '${yourWalletAddress}'
  const hash = '${generatedHash}'
  const message = 'Please sign to let us verify\nthat you are the owner of this address\n'+walletAddress+'\n\nRequest ID '+hash;
  const signature = await wallet.signMessage(message);
  return signature;
}
```

Take note that the message should remain unchanged, only walletAddress and hash should vary. Take a hash from the response of the following endpoint:

```typescript
[GET] {{baseURL}}/users-service/auth/signature/hash
Headers:        'Content-Type': 'application/json',
                'Accept': '*/*',
                'X-Account-Wallet': {{your wallet address}}
```

## **Authorize**

Use our /users-service/auth/login endpoint to generate an access token

```typescript
[POST] {{baseURL}}/users-service/auth/login
Body:           {"signature": signature,
                "wallet": walletAddress}

Headers:        'Content-Type': 'application/json',
                'Accept': '*/*',
                'X-Account-Wallet': {{your wallet address}}
                'X-Account-Login-Hash': {{generated hash}}
```

In response, you will receive an access token that can be used in the other endpoints as an Authorization header.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.metaproprotocol.com/developer-documentation/onboarding-the-web3-player/how-to-get-authorization-data.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
