# Unlock Account (Login)

{% hint style="danger" %}
Please update SDK after v3.1.5 and  use UnlockAccount with \``` account.publicKey or `generateKeyPair` with `account.publicKey` ``
{% endhint %}

<details>

<summary>Step 1:  <a href="/pages/Qq7KOPmZlgENjxBqO0go">GET Account info</a> by address</summary>

{% code lineNumbers="true" %}

```ts
const account = LoopringAPI.exchangeAPI.getAccount({
  owner: accounStore.accAddress,
})
```

{% endcode %}

</details>

<details>

<summary>Step 2: Nonce &#x26; keySeed</summary>

{% code lineNumbers="true" %}

```ts
const nonce = account ? account.nonce : accounStore.nonce;

const msg =
  account.keySeed && account.keySeed !== ""
    ? account.keySeed
    : sdk.GlobalAPI.KEY_MESSAGE.replace(
      "${exchangeAddress}",
      LOOPRING_EXPORTED_ACCOUNT.exchangeAddress
    ).replace("${nonce}", (nonce - 1).toString());
```

{% endcode %}

</details>

<details>

<summary>Step 3: UnlockAccount</summary>

{% code lineNumbers="true" %}

```ts
const response = await LoopringAPI.userAPI.unLockAccount(
  {
    keyPair: {
      web3: connectProvides.usedWeb3 as unknown as Web3,
      address: account.owner,
      keySeed: msg,
      walletType: connectName,
      chainId: Number(chainId),
      accountId: Number(account.accountId),
      isMobile: isMobile,
    },
    request: {
      accountId: account.accountId,
    },
  },
  account.publicKey
);
```

{% endcode %}

</details>

```
```


---

# 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-protocol.loopring.io/loopring-account/sdk-guides/unlock-account-login.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.
