Api: CORS issue

Created on 14 Nov 2018  路  4Comments  路  Source: Bungie-net/api

The API always returns CORS issue when i make requests

//ERROR
ErrorCode: 2107
ErrorStatus: "OriginHeaderDoesNotMatchKey"
Message: "Origin header does not match the provided API key."
MessageData: {Origin: "http://localhost:3000"}

//CODE
axios
      .get(
        `https://www.bungie.net/Platform/Destiny2/SearchDestinyPlayer/-1/${id}/`,
        {
          headers: {
            "X-API-Key": process.env.REACT_APP_API_KEY
          }
        }
      )
//Bungie.net 

screen shot 2018-11-14 at 14 28 15

Most helpful comment

In the origin header for local testing use *

screen shot 2018-11-16 at 10 33 02

All 4 comments

Try using an * for local testing and see if that works.

Worked, thanks

Hello. I'm currently having the same issue here and I would like to see if this solution would work for me, but I'm a bit confused by what you two mean using the *. Is this related to the Access-Control-Allow-Origin header?

In the origin header for local testing use *

screen shot 2018-11-16 at 10 33 02

Was this page helpful?
0 / 5 - 0 ratings