Skip to content

Instantly share code, notes, and snippets.

@drewtang
Created December 14, 2011 16:05
Show Gist options
  • Save drewtang/1477180 to your computer and use it in GitHub Desktop.
Save drewtang/1477180 to your computer and use it in GitHub Desktop.
Yammer Connect Example
yam.connect.loginButton('#yammer-login', function (resp) {
if (resp.authResponse) {
yam.request({
url: '/api/v1/users/current',
type: 'GET',
success: function (msg) {
document.write('<IMG SRC="' + msg.mugshot_url + '">' + '<h3>Welcome Back ' + msg.full_name + '!</h3>');
},
error: function (msg) { alert('Data Not Saved: ' + msg); }
});
}
else {
document.getElementById('signin').onclick=function () {
yam.login(function (resp) {
if (resp.authResponse) {
yam.request({
url: '/api/v1/users/current',
type: 'GET',
success: function (msg) {
document.write('<IMG SRC="' + msg.mugshot_url + '">' + '<h3>Welcome ' + msg.full_name + '!</h3>');
},
error: function (msg) { alert('Data Not Saved: ' + msg); }
});
}
})
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment