Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Request origin did not match allowed origins - Need assistance with CORS issue #30

@ruelustin5

Description

@ruelustin5

Hello ! I am developing a React application and I am trying to integrate it with your public API (https://api.getsling.com/v1/). My application is currently running on http://localhost:3000 during development.

To interact with your API, I need to make cross-origin requests from my frontend. However, when I try to do this, I encounter the following error: "Request origin did not match allowed origins"
This error suggests that my application's origin is not authorized to make requests to your API, which is likely due to CORS (Cross-Origin Resource Sharing) restrictions. Here is an example of the code I am using:

const apiUrl = 'https://api.getsling.com/v1/users';

const fetchUsers = async () => {
  try {
    const response = await fetch(apiUrl, {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer 85c1aad28ac4437c9c4f0e6c4b0f2810',
        'Accept': 'application/json',
      },
    });

    if (response.ok) {
      const users = await response.json();
      console.log('Users:', users);
    } else {
      console.error('Failed to fetch users:', response.status, response.statusText);
    }
  } catch (error) {
    console.error('Error:', error);
  }
};

Any advice or documentation you could provide would be greatly appreciated.

Thank you for your support!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions