Is there any way to fetch swagger open api in react?

is there any way to fetch api data from react? mine is stucked by “cors origin allowed header is not presented”!. Even adding x-api-key and secret in react fetch doesn’t work.
Hope for reply . . .

Of the top of my head, I think you two options, if you want call authticated API endpoint:

  • Use frontend platform, its the framework that all MFEs implements, it has +3 services, auth (what you need), i18n and anayltics…etc
  • Reverse engineer frontend platform auth service, look at how frontend paltform is doing auth call. And then replicate that in your env.

Frontend Platform: GitHub - openedx/frontend-platform: A framework for Open edX micro-frontend applications.

1 Like

But also in any case you need to make sure you have correct CORS settings. CORS settings needs to be configured both frontend and backend. In backend you need to allow your origin.

1 Like

much appreciated. thanks i’m working on it. chit tal. R Bwarr mwa chi mwa chi .

1 Like