This is OAuth Authentication , you must interact with the Yammer OAuth webpage to receive a token.
You should look at the asp.net mvc example in CodePlex sources .
In HomeController.cs:
[HttpPost]
public ActionResult Index(IndexViewModel model)
{
if (ModelState.IsValid)
{
var myConfig = new ClientConfigurationContainer
{
ClientCode = null,
ClientId = model.ClientId,
ClientSecret = model.ClientSecret,
RedirectUri = Request.Url.AbsoluteUri + Url.Action("AuthCode")
};
var myYammer = new YammerClient(myConfig);
var url = myYammer.GetLoginLinkUri();
this.TempData["YammerConfig"] = myConfig;
return Redirect(url);
}
return View(model);
}
Yammer :
public ActionResult AuthCode(String code)
{
if (!String.IsNullOrWhiteSpace(code))
{
var myConfig = this.TempData["YammerConfig"] as ClientConfigurationContainer;
myConfig.ClientCode = code;
var myYammer = new YammerClient(myConfig);
return View(myYammer.GetUserInfo());
}
return null;
}