Enable CORS – PB Docs 2022

Enable CORS

When calling the “/connect/token” API in JavaScript, you may
come across the cross-origin resource sharing (CORS) error like
below.

auth_21.png

This error occurs if the web page and the server are not in the
same
origin
. You can resolve this error by keeping the web page and
the server in the same origin, or configuring to allow some (not all)
cross-origin requests.

Follow the steps below to enable CORS for some requests (using a
named policy):

1) In the Startup.cs file, add the following CORS policy to the
ConfigureServices method:

2) In the same Startup.cs file, use the policy in the Configure
method:

auth_22.png

The following script will allow all cross-origin requests
(use this
cautiously
):


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x