Welcome to my blog, stay tunned :
Home | Blogs | Stephane Eyskens's blog

AAD Apps versus Yammer Apps to consume Yammer APIs

This blog post was moved to https://stephaneeyskens.wordpress.com/2015/08/02/aad-apps-versus-yammer-...

Comments

Does this actually work?

Have you been able to implement this?

I can't find any evidence of AAD tokens being able to authorise requests against the Yammer REST API and of course Yammer regard third party developers with disdain and offer no form of support or assistance, making it very hard to judge whether the problem is with configuration, the way the token is being used or for some other reason.

delegate permissions

Yes it works but only with delegate permissions. Create a native app in Azure AD and allow it to access Yammer, copy and paste the below code in a console app

AuthenticationContext authenticationContext =
new AuthenticationContext("https://login.windows.net/{tenantid}/", false);

AuthenticationResult res =
authenticationContext.AcquireToken("https://www.yammer.com/", "{clientid}", new Uri("https://collab365/"), PromptBehavior.Always);
HttpWebRequest req = HttpWebRequest.Create("https://www.yammer.com/api/v1/users/current.json") as HttpWebRequest;
req.Headers.Add("Authorization", "Bearer " + res.AccessToken);
using(StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()))
{
Console.WriteLine(sr.ReadToEnd());
}

Replace tenantid & clientid with your own values. You can watch my Collab365 event if you want to know more about that.

Best Regards