Waivio

Experimenting with AIOHA package & trying to integrate it in flutter project

13 comments

sagarkothari887 K2 months agoPeakD2 min read

Hello

Saw your annoucement that now you are


& was april-fooled for almost 1 hour 🤣
Realized only after reading comments

Understanding Setup

Let's get to the subject. I am experimenting with AIOHA & trying to integrate it in Flutter project. As you know that, flutter project supports multiple platforms. My flutter project intends to support web, iOS & Android. To start with, I'm focusing on web support.

Here is how flutter-web-app folder structure looks like.

https://files.peakd.com/file/peakd-hive/sagarkothari88/23t77MGo8X9JSXzWtEApCebnDG2hA5PzC4G64Rd3TCZcVf7n1KKyquvJtdRgVn2fLESkw.png

I have added following script tag in body.

<script type="module">
      import * as Aioha from "./aioha@1.6.0-beta.4.js";
      window.Aioha = Aioha;
      console.log("Aioha initialized", aioha);
      aiohaInitialized = true;
</script>

In another script tag, I've added following code to make sure that I access AIOHA only after it is available.

var aiohaInitialized = false;
let aioha = null;

async function someFunctionToUse(some, params) {
    if (!aiohaInitialized) {
        console.error("Aioha not initialized");
        // try again after few miliseconds when aioha@1.6.0-beta.4.js is available/downloaded
        return;
    }
    if (aioha === null) {
        // we have aioha.js, let's set up an aioha instance
        aioha = window.Aioha.initAioha({
            hiveauth: {
                name: "AiohaExperiments",
                description: "Testing aioha login - keychain & hiveauth methods",
            },
        });
    }
    // we are good to go to use aioha
}

Understanding Error

HiveKeychain based login works very well & I didn't face any error. However, HiveAuth started giving me error.

https://files.peakd.com/file/peakd-hive/sagarkothari88/23t7939qyNRh7yvj6dBEbzakqkMTU7Zg9hJ2ro41AMWmgG6uj5NL8UZ7Xqv81SqTYSDkk.png

So, when I tried logging in with HiveAuth, I got error.

https://files.peakd.com/file/peakd-hive/sagarkothari88/23t76pL8Gwfb17doomk7gCs7pM6Mie4ZgrZ4CKjb3jMpCexN83P1FEmjr7NPXq7UeMCY1.png

Error from console

https://files.peakd.com/file/peakd-hive/sagarkothari88/23tGbncXXLGsTtYStrCTo47fCJ4Hmy6kd9DK4LkKNMRJ6zBWXt2TJFhNVTBqNXM32VBda.png

Network Tab from Chrome Inspector

https://files.peakd.com/file/peakd-hive/sagarkothari88/23t79KzCSJ8NDatMoD8c51VvcSBUmZQxiEsgwDZVFfWcYZiHiYeorGW5EfrBXT1zQ1rht.png

Next Steps

  • I request
    to look into this issue.
  • I assume by bundling together, we can avoid that issue. I'm not js/front-end expert here so may be I am wrong.
  • Once, this issue is solved, I'll switch to iOS & Android integration

❤️ Love the work I do, support

& me ❤️

https://images.hive.blog/u/sagarkothari88/avatar

https://images.hive.blog/u/threespeak/avatar

Comments

Sort byBest