> For the complete documentation index, see [llms.txt](https://xact.gitbook.io/xact/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xact.gitbook.io/xact/sdk/php/login.md).

# Login

The following sample will show you how to make a simple connection handler. First,  we will generate a QR Code that will be the entry point by which users can interact with your dApp. Once scanned, the account details are forwarded to you.

## Prerequisites: <a href="#pre-requisites" id="pre-requisites"></a>

{% content-ref url="/pages/-Mg5U-5eb4UqoAhffuDM" %}
[Getting started](/xact/sdk/php/getting-started.md)
{% endcontent-ref %}

## Generate a QR Code

In order to generate a QR Code you need to pass a Webhook to the generateQRCode method. This Webhook will be called every time a new user scan the QR Code.

{% hint style="info" %}
You can set the scope in the params to fetch the NFT during the login process.&#x20;
{% endhint %}

```php
/* Define the scope */
$scope = ['profile', 'nft'];
/* Define a Webhook */
$webhookUrl = '';
/* Define a uniq Id that identify the browser */
$uniqId = '';

/* Generate the QR Code */
$qrCode = $client->generateQRCode($scope, $uniqId, $webhookUrl);
```

Find more details on the Webhook implementation [here](https://xact.gitbook.io/xact/sdk/php/getting-started#step-3-webhook-use-case)

On each user's connection, you will receive a JSON like this :

| Fields      | Type                   | Description                                             |
| ----------- | ---------------------- | ------------------------------------------------------- |
| accountId   | string                 | Account Id of the User                                  |
| balance     | number                 | Account's balance in HBAR                               |
| environment | 'mainnet' or 'testnet' | Environment identified from the SDK API Key             |
| profile     | Profile                | Profile of the user if it exist and if defined in scope |
| nft         | NFT\[]                 | NFTs of the user if defined in scope                    |
| uniqId      | string                 | Custom Uniq Id                                          |

The Profile will be defined as below :

| Fields         | Type   |
| -------------- | ------ |
| email          | string |
| first\_name    | string |
| last\_name     | string |
| profile\_image | string |
| country        | string |

The NFT will be defined as below :

| Fields      | Type      |
| ----------- | --------- |
| tokenId     | string    |
| name        | string    |
| description | string    |
| category    | string    |
| creator     | string    |
| cid         | string    |
| url         | string    |
| supply      | number    |
| nftIds      | string\[] |
