i tried to call '/api/v1/groups ’ on React using axios.
i added ‘http://localhost:8080 ’ in API-trusted origins.
but cors error keeps show up
this is my axios instance
const client: Axios = axios.create({
baseURL: ‘https://dev-88058956.okta.com/ ’,
headers: {
‘Content-Type’: ‘application/json’,
Authorization: SSWS ${api_token}
,
‘Access-Control-Allow-Origin’: *
,
Accept: ‘application/json’,
‘Access-Control-Allow-Credentials’: ‘true’,
},
withCredentials: true,
});
client.get(api/v1/groups
);
what am i missing?
thanks.
hyunvirus9999:
api/v1/groups
Hi,
If you access the API from the front end or browser and the API does not support CORS, you will receive a CORS error. APIs that are not CORS-enabled can only be accessed from the server side or backend.
Please refer to our doc: Okta Help Center (Lightning)
2 Likes
thanks. i solved this problem.
as you said, api/v1/groups API dose not enable CORS.
i understood that there are some API can enable CORS , and rest can’t.
so i have to use other API or use it in backend.
system
Closed
March 28, 2024, 4:23pm
4
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.