> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runkariz.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Magic link authentication 

> Integrate your end users without any frontend code.

### Overview

Our **Magic Link** allows you to deliver an in-browser Link experience without requiring any frontend code.

The Magic Link experience is sent to your end users via a secure URL.

Benefits:

* **Fast proof of concept** without making frontend changes to embed Link into your app

* **Your users can authorize integrations** without logging into your app, enabling custom user journeys

<iframe width="560" height="315" src="https://www.youtube.com/embed/yGeoSag5GNk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />

<iframe width="560" height="315" src="https://www.youtube.com/embed/HNQYok7ECfQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />

***

### Authenticate user with Magic Link URL

Magic Links are generated **Programmatically via API** in 3 easy steps:

<Steps>
  <Step title=" Generate an user Authentication link">
    To generate the authentication link, call the following endpoint:
    `GEThttps://api.demo.trykariz.com/api/KarizClientApp/GetTpUserAuthDisposableToken?tpUserId={tp_app_user_id}&redirectUrl={redirect_url}&scopes={scope_names}`
  </Step>

  <Step title="Set the correct parameters">
    `tpUserId` = The ID of the user that you want to create. You will use this ID moving forward to get data for this user, so use a unique id for each user.

    `redirectUrl`= The url of your application that you want your users to get redirected back to after they finish the authentication.
    `Scopes` = The scopes determine which channels your user will be asked to authenticate to. You can add multiple scopes to 1 request to request multiple authentications at a time

    `-H 'Authorization: Bearer` this is the token your application received when creating an account. Replace this with your unique code
  </Step>

  <Step title=" Redirect user to Authentication link">
    After sending this request and magic link will be returned to you called `uri` . Your users should be redirected to this link in order to&#x20;
  </Step>
</Steps>

*The Authentication link will expire in 1 hour*

### Example request

```
curl -X 'GET' \
'https://api.demo.trykariz.com/api/KarizClientApp/GetTpUserAuthDisposableToken?tpUserId=0283544273&redirectUrl=https%3A%2F%2Fmyapp.com&scopes=shopify&scopes=woocommerce&scopes=bol&scopes=amazon' \
-H 'accept: text/plain' \
-H 'Authorization: Bearer 287ys7a17te61238y12387wqt8tdqt6sad8fd1826871t2186et'
```

In this example the following parameters are used in the request:

`tpUserId` = 0283544273

`redirectUrl`= [https://runkariz.com](https://runkariz.com)

`Scopes`  = shopify, woocommerce, bol, amazon

`Bearer `= 287ys7a17te61238y12387wqt8tdqt6sad8fd1826871t2186et

***

### Available Scopes (E-commerce channels)

* shopify

* woocommerce

* bol

* amazon

| name | required | type | data type | description |
| - | - | - | - | - |
| scopes | required | query | string\[] | The E-commerce channels your users will be asked to authenticate with |
| tpUserId | required | query | string | The user id that you want to execute workflow for |
| redirectUrl | optional | query | string | The URL which user will be redirected to after finishes the authentication flow |

##### Responses

| http code | content-type | response |
| - | - | - |
| 200 | application/json | See the sample response |
| 400 | application/json | \{"code":"400","message":"Bad Request"} |
| 405 | text/html;charset=utf-8 | None |

Sample Response (200):

```
{

    "uri": "https://www.demo.trykariz.com/en/tpuser/authorize?token=MvznqqrmRYhfTlRdjsDXaHjFbBqquHN8IgTtObvrRX7AGSJdA4NJ4y40q9sMALixHz1F%2Fjic%2FdO1YwA1T41Wr0g2TAO57R1fKul2q7bfARgj7BLpfP%2FGnjKhdPG6eL9q%2BUjwXIU45ppkw%2F7N7qrCjYaWaPdyeqFGtyfRbAPBv9DJvEdWoo7FM0o9wH4M4wEe359KqNVYxCrX6jkZF5rqwnQt5WdgdUQMTY5ub9lMq4FOG1422MMR7ND6zgsxjVcqWPZ1Slt0YbKR%2FW3kZouiTH8ewAn5xu3C%2FrasxTvyGMNzgvnrRLqLLguyaERp6foS2lZ0mYj5FPI95InoQdu79CDlAKp%2FY7J0y5m3K2mgZkM63%2Fqt5QoY0rhkpvFc7qe9NJDWW%2FY1HMVtQhy%2Fk0kqsDA8nQaXqi%2BTftAh5j4BXvPZm5%2BleaC5kG6sSQtriReR9nMGdwwYp%2B37J6X7XUxSOWVUSthfrhgVuRVOlD%2BBgw3ldag2xE%2Bk3kTebZM6rzYlmww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