XHR Login

4 posts

Flag Post

Our game has two automatic modes, one for guests and one for logged in users. Based on the requested via the JS API your provide I make the appropriate decision of guest or logged in users when the game starts.

However, how does one know when a guest has logged in via the login box at the top of the site? This seems to be an XHR login and I can’t find any information about there being any kind of callback to our iframe informing us of such a login.

Are we out of luck?

 
Flag Post

You can listen for guest signing in through an event listener however I don’t know how or if this applies to Javascript in addition to the intended AS3 API.

 
Flag Post

Well only one way to find out :D. Yeah unfortunatlly we are not AS3 cause we are a unity3d game. Thanks for the information UnknownGuardian, I will keep this posted on my findings.

 
Flag Post

Worked on the first try.. for people having a little bit of trouble reading the ASC and needs it for JS alone here is what it looks like:

kongregate.services.addEventListener(“login”, onKongregateInPageLogin);
function onKongregateInPageLogin(){
document.location.reload(true);
}

This will reload our iframe shell and re-auth it’s self with most recent creds to pass off to our unity3d player.. Problem solved, thanks UnknownGuardian.