Could someone please provide an example to programmatically create an Oauth2 flow so that I am able to login using an ESRI user account and prevent the ESRI login prompts. I have started to use the Oauth2 rest Authorize service to get a token but keep getting a cors error. I verified that for some reason the ESRI service is not sending back the CORS headers. I can however call the Oauth2/ rest token endpoint with CORS headers and a token no problem but I cant get a token for an ESRI user without a code from the Authorize endpoint. If someone has an example or might know why the CORS headers are missing from the Authorize call it would be appreciated. I also dont want to put a proxy in if I dont have to.Thanks!