Forum Discussion

Heath_Carson's avatar
2 years ago

CORS issue when accessing authorize endpoint from localhost

Hi there,

I am trying to access the /authorize endpoint from locahost and getting CORS issue despite setting all the required CORS headers in my app code. The same endpoint works pretty well in postman and had no issues with CORS. 

I have reached out to the API support but did not get the relevant support from them. Any pointers to resolve the issue is much appreciated.

 

The actual error is :

Access to fetch at 'https://secure.myob.com/oauth2/v1/authorize/' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

 

 

  • Will_H's avatar
    Will_H
    MYOB Moderator

    Hi Heath_Carson ,

    Please note: I'm not part of MYOB's API support teams, I'm responding as an interested party, not as an authoritative MYOB source.

    CORS is usually related to browsers, there's some discussion here: 
    https://academind.com/tutorials/cross-site-resource-sharing-cors

    Postman doesn't care about CORS when you're using the desktop app version, you may need to either change some settings in your browser, or configure some kind of middle-service to handle the responses and provide back CORS compliant responses to your consuming application.

     

    Hope this gives a hint in the right direction, I won't be any help for followup questions.