1

I'm running a Yammer Embed script on my client's Sharepoint Online tenant, which displays conversations/messages.

I am looking to create a dropdown box that can be used to filter the messages based on which Yammer groups the user is apart of.

To make the dropdown dynamic, I need to make a call to the Yammer API to get the groups of the current user - I've been using the API call: /api/v1/groups.json?mine=1

This gives back valid JSON with correct data when browsed to directly, however when called inside the Sharepoint Online tenant I get the following error:

XMLHttpRequest cannot load https://www.yammer.com/api/v1/groups.json?mine=1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://client.sharepoint.com' is therefore not allowed access. The response had HTTP status code 401.

My question: Is there a way around this? I assume Yammer would need to implement CORS for this call (doubtful on getting them to do this). I've also tried the api.yammer.com/... URL to no avail.

Cheers!

  • 2
    Possible duplicate of [Yammer REST API CORS](http://stackoverflow.com/questions/24884267/yammer-rest-api-cors) – gotson Apr 12 '17 at 05:17
  • The answer at https://stackoverflow.com/questions/24884267/yammer-rest-api-cors/25568609#25568609 from the question @gotson links to above indicates you need to be using **api**.yammer.com instead of www.yammer.com. If you try that and still can’t get it working, you can fall to setting up a CORS proxy https://stackoverflow.com/questions/20035101/no-access-control-allow-origin-header-is-present-on-the-requested-resource/42744707#42744707 – sideshowbarker Apr 12 '17 at 06:03

1 Answers1

1

Are you using the JavaScript SDK? With that you register your JavaScript origins (where you host your custom code) on the Client Applications page, and then use the JS SDK to handle the authentication and authorization.

Brian Lyttle
  • 14,558
  • 15
  • 68
  • 104
  • Hi Brian, I am using Javascript SDK. I am getting same issue. I know, SDk is calling **api.yammer.com** and here it is **www.yammer.com**. How we can achieve this using JS SDK - or through any client side techniques? – Nithin CV Jun 01 '17 at 10:28