# Getting CORS error while accessing Okta Group API from angular code on http://localhost:4200

**URL:** <https://devforum.okta.com/t/getting-cors-error-while-accessing-okta-group-api-from-angular-code-on-http-localhost-4200/22304>\
**Category:** API\
**Created:** [November 1, 2022, 7:40am UTC](https://devforum.okta.com/t/getting-cors-error-while-accessing-okta-group-api-from-angular-code-on-http-localhost-4200/22304 "2022-11-01T07:40:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![khansubhan88](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/khansubhan88/32/4297_2.png) [@khansubhan88](https://devforum.okta.com/u/khansubhan88)\
**Post date:** [November 1, 2022, 7:40am UTC](https://devforum.okta.com/t/getting-cors-error-while-accessing-okta-group-api-from-angular-code-on-http-localhost-4200/22304/1 "2022-11-01T07:40:51Z")

</div>

Hi,

I am getting CORS error while accessing Okta Group API from angular code on [http://localhost:4200](http://localhost:4200)

I have configured trusted origins in okta as below:

 ![Okta-OriginSetup](https://global.discourse-cdn.com/oktadev/original/2X/b/bc12312ccf8e9e40c5cc04679e080fe4714ca523.jpeg)

and below are the API call details:

 ![Okta-API-error](https://global.discourse-cdn.com/oktadev/original/2X/3/3e7a12e3a74f75ec6eed983f351720816741bc9d.jpeg)

Am I missing anything here?

---

<div class="post-metadata">

**Author:** ![daniel.sanders](https://avatars.discourse-cdn.com/v4/letter/d/8dc957/32.png) [@daniel.sanders](https://devforum.okta.com/u/daniel.sanders)\
**Post date:** [November 1, 2022, 6:33pm UTC](https://devforum.okta.com/t/getting-cors-error-while-accessing-okta-group-api-from-angular-code-on-http-localhost-4200/22304/2 "2022-11-01T18:33:08Z")

</div>

Hello khansubhan88!

It looks like in your Request URL you have “-admin” as part of it, you’ll need to remove that to call the /users API and retrieve groups. Give that a try and let me know if that helps!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [February 13, 2024, 12:24am UTC](https://devforum.okta.com/t/getting-cors-error-while-accessing-okta-group-api-from-angular-code-on-http-localhost-4200/22304/3 "2024-02-13T00:24:19Z")

</div>

Closed on February 13, 2024, 12:24am UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
