Getting an error
Failed to load resource: the server responded with a status of 401 (Unauthorized)
localhost/:1 Access to XMLHttpRequest at 'http://192.168.50.203:8095/crowd/rest/usermanagement/1/session?validate-password=true&duration=1800' from origin 'http://localhost:4200' 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.
while invoking crowd rest api.
No issues when i run it on postman.
How can solve
It looks like you're getting a CORS error, so first try going to Crowd and adding 'localhost' under Crowd admin console -> Applications -> Crowd to see if that helps.
Otherwise, there could be some missing headers in your call or an issue with proxy configuration. How is the call different coming from postman vs running it directly? For example, are you running it on the same URL (http://192.168.50.203:8095/crowd), is Crowd running on HTTPS, or do you have a proxy configured?
For example, if you're using CURL you might want to try something like this:
curl -H "Origin: http://192.168.50.203" --verbose \
Otherwise, if you're using a proxy or SSL in front of Crowd you should be making the call with the right domain/scheme. If you can add the code you're using to hit the API endpoint as well as your postman call I can see what might be missing. Also, when you run postman, make sure you're running it from the same machine as your code. It could be that postman is adding some headers that are not added when you call it directly.
Hey admins! I’m Dave, Principal Product Manager here at Atlassian working on our cloud platform and security products. Cloud security is a moving target. As you adopt more products, employees consta...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs