> For the complete documentation index, see [llms.txt](https://leelee-1.gitbook.io/myinfo-connector-python-api-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://leelee-1.gitbook.io/myinfo-connector-python-api-doc/myinfo-connector-python-api/v1.0/callback.md).

# Callback

## Callback called by Myinfo service

<mark style="color:blue;">`GET`</mark> `http://localhost:3001/callback`

After login Myinfo and agree terms, Myinfo service automatically call myinfo-connector-python's callback API to pass auth code.

#### Query Parameters

| Name                                    | Type   | Description                                                                                                                                                                                                                          |
| --------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| code<mark style="color:red;">\*</mark>  | String | The authcode given by [myinfo's authorise API](https://public.cloud.myinfo.gov.sg/myinfo/api/myinfo-kyc-v3.2.2.html#operation/getauthorise)                                                                                          |
| state<mark style="color:red;">\*</mark> | String | Identifier that represents the user's session/transaction with the client for reconciling query and response. The same value will be sent back via the callback URL. Use a unique system generated number for each user/transaction. |

{% tabs %}
{% tab title="200: OK successfully called by Myinfo" %}

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <span>Callback from Myinfo. Wait for calling person data API</span>
    <span id="code-container">{{ code }}</span>
</body>

<script>
    window.addEventListener('load',
        function (event) {
            let code_element = document.getElementById('code-container')
            let code_text = code_element.innerHTML

            let url = `http://localhost:3001/users/me/external/myinfo?code=${code_text}`
            window.location.href = url
        }
    );
</script>
</html>

```

{% endtab %}
{% endtabs %}
