Update 5/14/2009: this demo now uses the OpenID User Interface Extension. It always sends the extension parameters and opens the window in a 450x500 form factor as recommended by the extension spec.
In a traditional OpenID relying party interface, the RP implements a UI, and two endpoints on its server for processing OpenID related stuff:
openid_identifier
parameter which is then ingested by an OpenID library to find out which provider is used by the identifier and make a secure association with the server.The code used to accomplish this experience is relatively simple, so I've included the relevant bits below. Please note that we're using the excellent YUI for the async call to /openid_finish.
<script type="text/javascipt">
function openPopupWindow(openid) {
document.getElementById('ops').style.display = 'none';
document.getElementById('bucket').innerHTML = 'Signing you in <img src="/img/spacer.gif"> handleOpenIDResponse(openid_args) {
document.getElementById('ops').style.display = 'none';
document.getElementById('bucket').innerHTML = 'Verifying OpenID response';
YAHOO.util.Connect.asyncRequest('GET', '/openid_finish?'+openid_args,
{'success': function(r) {
document.getElementById('bucket').innerHTML = r.responseText;
}});
}
</script>
<a class="javascript:openPopupWindow('yahoo.com');">
<img src="/img/spacer.gif">
<html><head></head>
<body>handleOpenIDResponse((window.location+'').split('?')[1]);window.close();">
</body>
</html>
This demo was created in response to Luke Shepard's post How to accept OpenID in a popup without leaving the page. Contact Brian Ellin (brian at janrain.com) for more info.