I am integrating yammer features in our app (web-front-end stack and using Yammer JS SDK). So, I want get all the groups of a login-ed user.
Inorder to get all the groups, I have tried to call the end points in two ways, /groups.json=mine
using SDK - resposne showing method not authorised
and www.yammer.com/api/v1/groups.json=mine=1
using normal ajax GET request- throwing access control origin issue.
API is perfectly working, while tested using google chrome browser - by disabling web security.
My question is how I can call www.yammer.com/api/v1/API_END_POINTS without cross origin issue using yammer JS SDK or any other technique?
I found an related answer in this Q & A , but still showing error for me.
Error :
XMLHttpRequest cannot load
https://www.yammer.com/api/v1/groups.json?mine=1. Response to
preflight request doesn't pass access control check: No
'Access-Control-Allow-Origin' header is present on the requested
resource. Origin 'https://xxx.dev.com' is therefore not allowed
access.
Code I have tried after login code :
1# GET Request - return $http.get('https://www.yammer.com/api/v1/groups.json?mine=1')
2# yammer JS SDK -
yam.platform.request({
url: "groups.json?mine=1",
method: "GET",
success: function (group) {
console.log(group);
},
error: function (group) {
console.error("There was an error with the request.", group);
}
});
I have already commented different Q&As for the opinion, but no luck, no one replied.
PS - My all other yammer APIs are working(login, post, message etc), which listed in Yammer REST API Docs, only I am facing problem with APIs hosted in wwww.yammer.com/api/v1, Not api.yammer.com
Thanks in advance
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…