Mohammad AL-Raoosh
Mohammad AL-Raoosh

Reputation: 731

AccountKit SDK was not initialized?

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

Answers (3)

Nantim Lord
Nantim Lord

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

Nikica Asanin
Nikica Asanin

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

Olga Kuznetsova
Olga Kuznetsova

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

Related Questions