JanRain Engage in an AJAX environment

We where looking to embed Janrain in a somewhat complex AJAX driven single page interface flow. The default behavior of the JanRain Engage part of the flow is to redirect the top window to the token_url. As you can imagine this messes up your SPI state.

After some mails with the excellent Janrain support desk, there seem to be some hidden flags. As we are probably not the only ones with this question, let’s share the workaround:

One way to do this is using the flags=stay_in_window flag.  What this does is forces the iFrame that our widget renders in to reload rather than the parent window.  So, if you’re using the iFrame version of our widget you’d set this up this way:

https://yourdomain.rpxnow.com/openid/embed?flags=stay_in_window&token_url=http://yourtoken/url

IF you’re using the modal overlay, you would modify this block of code:

<script type="text/javascript">

RPXNOW.overlay = true;
RPXNOW.language_preference = 'en';

RPXNOW.flags='stay_in_window';  <- Add the flags parameter here
</script>

Happy coding!

Be Sociable, Share!

Tags: , , , , ,

1 Response to "JanRain Engage in an AJAX environment"

  • Bruno says:
Leave a Comment

This blog is kept spam free by WP-SpamFree.