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

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@sagarkothari88·
0.000 HBD
Experimenting with AIOHA package & trying to integrate it in flutter project
Hello @techcoderx 

Saw your annoucement that now you are @vibecoderx 
& 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.

![Screenshot 2025-04-19 at 5.52.31 AM.png](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.

![Aioha-HiveAuth](https://files.peakd.com/file/peakd-hive/sagarkothari88/23t7939qyNRh7yvj6dBEbzakqkMTU7Zg9hJ2ro41AMWmgG6uj5NL8UZ7Xqv81SqTYSDkk.png)

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

![Error in HiveAuth](https://files.peakd.com/file/peakd-hive/sagarkothari88/23t76pL8Gwfb17doomk7gCs7pM6Mie4ZgrZ4CKjb3jMpCexN83P1FEmjr7NPXq7UeMCY1.png)

Error from console

![HiveAuth-aes.bundle.js not on my server](https://files.peakd.com/file/peakd-hive/sagarkothari88/23tGbncXXLGsTtYStrCTo47fCJ4Hmy6kd9DK4LkKNMRJ6zBWXt2TJFhNVTBqNXM32VBda.png)

Network Tab from Chrome Inspector

![Network Tab from Chrome Inspector](https://files.peakd.com/file/peakd-hive/sagarkothari88/23t79KzCSJ8NDatMoD8c51VvcSBUmZQxiEsgwDZVFfWcYZiHiYeorGW5EfrBXT1zQ1rht.png)

### Next Steps

- I request @techcoderx 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 @threespeak & me ❤️

<center>

[![Support @sagarkothari88](https://images.hive.blog/u/sagarkothari88/avatar)](https://witness.the-hive-mobile.app/#/witnesses/@sagarkothari88)
### [Vote sagarkothari88 as Hive Witness](https://witness.the-hive-mobile.app/#/witnesses/@sagarkothari88)

[![Support @threespeak](https://images.hive.blog/u/threespeak/avatar)](https://witness.the-hive-mobile.app/#/witnesses/@threespeak)

### [Vote for 3Speak as Witness](https://witness.the-hive-mobile.app/#/witnesses/@threespeak)
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,