Reputation: 19
I am using "ng2-account-kit" library for login in an angular 4 app. I have initialized SDK in my login component like this :
ngOnInit() {
AccountKit.init({
appId: '{{FACEBOOK_APP_ID}}',
state: '{{csrf}}',
version: '{{ACCOUNT_KIT_API_VERSION}}'
})
}
Also I added this :
<script src="https://sdk.accountkit.com/en_US/sdk.js"></script>
in my index.html file.
I am getting "AccountKit SDK was not initialized. Call AccountKit.init first." error. But when i reload the same page, it works properly.
I also tried initializing account kit on my app.component.ts file but got the same error.
Can anyone please tell what I am missing or where to properly initialize the account-kit?
Upvotes: 0
Views: 611
Reputation: 178
I also had same issue. I added the following script in the index.html.
<script type="text/javascript">
AccountKit_OnInteractive = function(){
AccountKit.init(
{
appId:"myAppId",
state:"{{csrf}}",
version:"myAccountKitApiVersion",
fbAppEventsEnabled:true,
debug:true
}
);
};
myAppId and myAccountKitApiVersion can be created by using the help of the following video. https://www.youtube.com/watch?v=o2-PCiiJzr4
Upvotes: 0