microsoftgraph / microsoft-graph-explorer-v4

React/Redux version of Graph Explorer used to learn the Microsoft Graph Api
https://developer.microsoft.com/graph/graph-explorer
MIT License
212 stars 89 forks source link

Client Error: Could not connect to the sandbox #2569

Closed sandrock closed 1 year ago

sandrock commented 1 year ago

Describe the bug

I am trying to use the Graph explorer located at https://developer.microsoft.com/en-us/graph/graph-explorer. All the queries I try fail. The UI indicates:

Client Error: Could not connect to the sandbox - 0

It occurs being authenticated or not.

It it related to #1310? I believe the CORS problem is only related to file downloads.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://developer.microsoft.com/en-us/graph/graph-explorer
  2. Click on "Getting started", "GET my profile"
  3. Click on "Run query"
  4. UI displays: Client Error: Could not connect to the sandbox - 0
    The query should execute and display a response

Expected behavior

The UI does not display a precise enough problem.
A random user would not understand was is wrong.

Desktop

Additional context

Here are a few logs from the browser console:

XHR OPTIONS [https://graph.office.net/en-us/graph/api/proxy?url=https://graph.microsoft.com/v1.0/me](https://graph.office.net/en-us/graph/api/proxy?url=https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fme)
CORS Missing Allow Origin

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://graph.office.net/en-us/graph/api/proxy?url=https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fme. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 500.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://graph.office.net/en-us/graph/api/proxy?url=https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fme. (Reason: CORS request did not succeed). Status code: (null).
Onokaev commented 1 year ago

Hey @sandrock. Sorry about this experience. I have tested the app on multiple browsers and can't reproduce this. Try shft+reload on the page and run the queries again. Let me know if the issue is still there

sandrock commented 1 year ago

I found the reason.

For privacy and security, one of my firefox extension - uMatrix -, protects against referer leaking. Disabling "referer spoofing" makes the app work.

BUT, it looks like this endpoint https://graph.office.net/en-us/graph/api/proxy?url=https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fme returns a 500 error because of the referer spoofing feature. Maybe something minor to look at.

Hopefully, this post will help other users having the same issue.

Onokaev commented 1 year ago

Sounds good! Glad you solved it. The description you have added will definitely help others with the same issue. Feel free to open a new issue if you experience any other problems