Yammer REST API CORS error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource - yammer

We are working with REST APIs of Yammer and sometimes we are getting below exceptions and not able to complete requests.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.yammer.com/api/v1/users/followed_by/XXX.json?&_=XXX. This can be fixed by moving the resource to the same domain or enabling CORS.
we added web url to javascript origins too. It is observed in IE and Firefox too.
#Yammer team: can you please check. Thanks.

Related

CSRF using AJAX. Why is it possible?

Steps to reproduce:
Go to https://stackoverflow.com/
Open developer console in your web browser
Execute the following JS code:
fetch(`https://webhook.site/5a6f8001-3646-4b3e-bd76-a4562af5a9ef`, { credentials: 'include' })
Go to https://webhook.site/#!/5a6f8001-3646-4b3e-bd76-a4562af5a9ef
You should see the HTTP request on https://webhook.site
Why does the HTTP request reach the server?
Does this violate Same Origin Policy?
First of all, do not mix SOP, CORS and CSRF.
SOP (same-origin policy) checks are performed by the browser and help to protect resource in your origin that access from "other" origins. If they needed to be allowed permission to they could read your contents, you need to define rules to extend to restrictions called CORS.
CSRF (cross-site request forgery) is an attack that is helping to create or send a malicious invalidated request via the victim's cookie. Every request after reach to target origin with the victim's cookie that will be executed via that user's permission. So, The attacker does not read the response. Also, you cannot read responses because of Same Origin Policy rules unless they do not allow read to their content with CORS rules.

Spring Security Oauth2 Swagger

I am attempting to configure Swagger Authentication on my resource server, so that I can authenticate against my authorization server.
I have the resource and authorization servers separated. They are both starting up on my localhost with different ports.
Resource Server on port 8083
Authorization Server on port 8081
Whenever I attempt to "Authorize", there is a CORS issues.
I forked a project from another website to use as my testing grounds. Below is the forked project.
https://github.com/cbriarnold/oauth2-spring-boot-2.0.2
To test, once both the authorization server and resource server are started, do the following:
Go to http://localhost:8083/swagger-ui.html
Click on "Authorize" button
Click on "Authorize" button in dialog
If you have the developer tools open, you will see that there is the CORS error
Access to fetch at 'http://localhost:8081/oauth/token/' from origin 'http://localhost:8083' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
The http status code associated with the above CORS error was 302.
So, I modify the source to try to permitAll (I know this is undesired from a security perspective, but I am just trying to figure out what is going on). I will receive the same CORS error, but with the https status code of 403. Code is found on the following branch.
https://github.com/cbriarnold/oauth2-spring-boot-2.0.2/tree/permitAll
Any suggestions?
I think you need to add #CrossOrigin(/*your hitting server*/) on your controllers
it's a chrome security check to see if your are permitted to talk with that server or not it sends an option request at first and if you're permitted it send your original request which is accessing swagger
if you want to make sure if that is a cross origin problem or not try to send that request via postman because postman send your request direct without option request at first

No 'Access-Control-Allow-Origin' header is present on the requested resource does not apply to postman

I have implemented a restful service. I have tested it using an ajax request within the application and also with postman client and both worked. But when i try to send an ajax request from a different application i get the below error in browser console.
http://localhost:8080/AusIncomeCalculator/AUSTax/post. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8089' is therefore not allowed access.
I don't understand how the postman client get a successful response while the other applications cannot.
RESTful service is hosted in JBOSS-eap 7.0 with rest easy
What happen is for security reasons, browsers restrict cross-origin HTTP requests initiated from within scripts.Postman is a REST Client that runs as an application inside the Chrome browser. It is specifically designed for testing rest APIs, and therefore it doesn't restrict cross origin resource request.

Cross-Origin Request Blocked error while Requesting WebAPI services

I am working on a OJET framework project on NetBeans. And I am making a call to .Net WebAPI service through Ajax. The request is reaching the server fine and it is getting processed fine, anyhow while receiving the data I can the below error in browser console.
"Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource"
I know I am working on cross platforms but not sure how to resolve this issue.
Can anyone help me on this?
Thanks in advance.

Requesting an API which uses CORS on IE7

I have created an ASP.NET Web API which uses CORS.
As IE7 doesn't support CORS, what would be the result if I made a request from another origin to this API, using IE7?
Am I right in saying that as IE7 is pre-CORS, this would allow the API to be requested, and by-pass the cross-origin checks?
The same origin policy predates IE7. Any browser that does not support CORS will simply not allow you to make cross-domain ajax requests. The same origin policy is enforced in IE7. Perhaps JSONP is an option for you. Hard to say without more knowledge of your situation. If JSONP is not an option for you, the request must be proxied from a server on the same origin when using IE7.

Resources