# PairSession.showView() and other not work

**URL:** <https://community.homey.app/t/pairsession-showview-and-other-not-work/61036>\
**Category:** Developers\
**Created:** [February 25, 2022, 3:02pm UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036 "2022-02-25T15:02:13Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kraineff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kraineff/32/47228_2.png) [@Kraineff](https://community.homey.app/u/Kraineff)\
**Post date:** [February 25, 2022, 3:02pm UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/1 "2022-02-25T15:02:13Z")

</div>

I tried showView() and other methods in onPair().  
And they do absolutely nothing, they are just ignored, with or without await. Writing in TypeScript, and adding comments like //@ts-ignore

The only option that worked for me was Homey.emit() from View.html to onPair() to make some checks and Callback result to View.html to make a Homey.showView()

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [February 25, 2022, 3:16pm UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/2 "2022-02-25T15:16:13Z")

</div>

Code or it didn’t happen.

---

<div class="post-metadata">

**Author:** ![Kraineff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kraineff/32/47228_2.png) [@Kraineff](https://community.homey.app/u/Kraineff)\
**Post date:** [February 25, 2022, 6:37pm UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/3 "2022-02-25T18:37:27Z")

</div>

Something like this. Even async/await don’t work. Also while making pair.emit(""), it not emit and not send it to View.html. In general, not a single pair command does not work, They only works in View.html

```auto
onPair(pair: Homey.Driver.PairSession) {
        //@ts-ignore
        pair.showView("list_devices");
    }

```

---

<div class="post-metadata">

**Author:** ![Kraineff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kraineff/32/47228_2.png) [@Kraineff](https://community.homey.app/u/Kraineff)\
**Post date:** [February 25, 2022, 6:39pm UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/4 "2022-02-25T18:39:28Z")

</div>

The only method I have for bypassing broken commands is this:

In onPair():

```auto
pair.setHandler("check", async () => {
            return await this.session.checkAuth();
        });

        pair.setHandler("start", async () => {
            return !this.session.ready ? await this.session.getAuthUrl() : "list_devices";
        });

```

In auth.html

```auto
<script type="application/javascript">
    Homey.emit("start").then((view => {
        if (view === "list_devices") {
            Homey.showView(view);
        } else {
            Homey.setTitle("Авторизация");
            document.getElementById("wrapper").style.display = "flex";
            document.getElementById("ya-button").href = view;

            let check = setInterval(() => {
                Homey.emit("check").then((result) => {
                    if (result) {
                        clearInterval(check);
                        Homey.showView("list_devices");
                    }
                });
            }, 5000);
        }
    }));
</script>

```

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [February 25, 2022, 7:07pm UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/5 "2022-02-25T19:07:28Z")

</div>

> [@Kraineff](#):
>
> Something like this

Well yes, obviously, but of course we need more context if you want help. For instance, how have you configured your pairing steps in `app.json`?

FWIW, I don’t know why the TS declarations are missing basically all methods, I’ll post an issue [on Github](https://github.com/athombv/homey-apps-sdk-issues/issues).

---

<div class="post-metadata">

**Author:** ![Kraineff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kraineff/32/47228_2.png) [@Kraineff](https://community.homey.app/u/Kraineff)\
**Post date:** [February 25, 2022, 7:21pm UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/6 "2022-02-25T19:21:04Z")

</div>

driver.compose.json → pair

```auto
"pair": [
        {
            "id": "auth"
        },
        {
            "id": "list_devices",
            "template": "list_devices",
            "navigation": { "next": "add_devices" }
        },
        {
            "id": "add_devices",
            "template": "add_devices"
        }
    ]

```

---

<div class="post-metadata">

**Author:** ![Kraineff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kraineff/32/47228_2.png) [@Kraineff](https://community.homey.app/u/Kraineff)\
**Post date:** [February 25, 2022, 7:21pm UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/7 "2022-02-25T19:21:34Z")

</div>

File  
 ![CleanShot 2022-02-26 at 00.21.17@2x](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/e/1e595924ce330f098f33340f1630918265bd26c4.png)

---

<div class="post-metadata">

**Author:** ![Kraineff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kraineff/32/47228_2.png) [@Kraineff](https://community.homey.app/u/Kraineff)\
**Post date:** [February 25, 2022, 7:23pm UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/8 "2022-02-25T19:23:21Z")

</div>

setHandler is the only one that works in onPair()

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [February 26, 2022, 6:14am UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/9 "2022-02-26T06:14:15Z")

</div>

Regardless of whether the other methods are declared or not, they should work. Are you sure your HTML page isn’t erroring out on something? If you’re not already doing so, run the pairing process [from the developer website](https://tools.developer.homey.app/tools/pair) and keep your browser’s developer tools/console open.

---

<div class="post-metadata">

**Author:** ![Kraineff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kraineff/32/47228_2.png) [@Kraineff](https://community.homey.app/u/Kraineff)\
**Post date:** [February 28, 2022, 2:48am UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/10 "2022-02-28T02:48:42Z")

</div>

I checked absolutely everything, including the console.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [February 28, 2022, 6:18am UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/11 "2022-02-28T06:18:15Z")

</div>

Do you have the code of your app on Github?

---

<div class="post-metadata">

**Author:** ![Kraineff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kraineff/32/47228_2.png) [@Kraineff](https://community.homey.app/u/Kraineff)\
**Post date:** [March 3, 2022, 1:15am UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/12 "2022-03-03T01:15:23Z")

</div>

> <https://github.com/Kraineff/ru.yandex.alice/blob/main/drivers/SpeakerDriver.ts>

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 3, 2022, 6:19am UTC](https://community.homey.app/t/pairsession-showview-and-other-not-work/61036/13 "2022-03-03T06:19:54Z")

</div>

Your issue isn’t with `showView()` not working, but with the way you want to handle authentication:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/d/2da44b8d0adca95dc8c56376ca17a6af4742fe3f.png)

You can’t forward users to websites for authentication like that. As far as I know, you need to either use the [OAuth2](https://apps.developer.homey.app/the-basics/devices/pairing#oauth2-login) or the [Credentials Login](https://apps.developer.homey.app/the-basics/devices/pairing#credentials-login) views (it doesn’t look like Yandex is using OAuth2), or provide an alternative that doesn’t require directing the user to an external website.
