I\'m working on an ASP.NET web application that reads data from Yammer. I\'ve successfully acomplished authentication and getting messages from the \"home\" network.
So far what i have discovered is this: Due to some cross domain restriction, the SDK creates a hidden iframe on the page to serve as a proxy bridge to use the users primary network credentials and get access to external network resources. The network parameter is the key in the puzzle.
The obtained token can be then manually set for further requests whenever the page is reloaded, avoiding the login window to show up again.
yam.platform.login({ network: '{your-permalink-goes-here}' }, function (data) {
console.log('login-status: ',data)
if(data.status ==='connected')
yam.platform.request({
url: "oauth/tokens.json"
, method: "GET"
, success: function (tokens) { console.log('user-tokens:',tokens); }
, error: function (err) { alert("There was an error with the request."); }
});
})
Then for next requests, setAuthToken does the trick.
yam.platform.setAuthToken('{the-token-goes-here}'))