Reputation: 731
I have a problem with the AccountKit JavaScript SDK , When i integrate it with my website it works fine with Firefox but in Chrome it works fine first, but when i try to use it again it gives me this error:
'AccountKit SDK was not initialized. Call AccountKit.init first.'
Any idea?
Upvotes: 3
Views: 2603
Reputation: 41
The idea is to add the initialization immediately after the sdk loads. Seems like when there is much data/code to load before the initialization, it sometimes hangs. ie
<script src="https://sdk.accountkit.com/en_US/sdk.js"></script>
<script type="text/javascript">
AccountKit_OnInteractive = function(){
AccountKit.init(
{
appId:youID,
state:"{{csrf}}",
version:"v1.1"
}
);
console.log("{{csrf}}")
};
</script>
NOT
<script src="https://sdk.accountkit.com/en_US/sdk.js"></script>
// some code
<script type="text/javascript">
AccountKit_OnInteractive = function(){
AccountKit.init(
{
appId:youID,
state:"{{csrf}}",
version:"v1.1"
}
);
console.log("{{csrf}}")
};
</script>
Upvotes: 4
Reputation: 129
I have same issue and I solve it. Just call your AccountKit.init your main file(index.html) where your app hold all scripts. From me it looks like this: index.html
<script src="https://sdk.accountkit.com/en_US/sdk.js"></script>
<script type="text/javascript">
AccountKit_OnInteractive = function(){
AccountKit.init(
{
appId:youID,
state:"{{csrf}}",
version:"v1.1"
}
);
console.log("{{csrf}}")
};
</script>
Upvotes: 3
Reputation: 361
Can you add in the code that you're using?
https://developers.facebook.com/docs/accountkit/web
You do need to call AccountKit.init as part of the setup.
Upvotes: 0