The Lazy Developer's Guide to Authentication with Vue.js

Paul Simon

Hi I tried this but I am getting a CORS error when I try to login.

Access to XMLHttpRequest at 'https://dev-XXXXXX.okta.com… from origin ‘http://localhost:8080’ 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.


Admitedly I have not tried this exact example as I was trying to incorporate this into existing code. I have checked that my settings in the OKTA API screen are as specified above. Is there any reason for this? My Vue App talks to a Node App and in the route there I effectively add the following to any request. However, as I cannot see a way to do the equivalent for the calls that are going out to OKTA.
res.header(“Access-Control-Allow-Origin”, “*”);
res.header(“Access-Control-Allow-Headers”, “Origin, X-Requested-With, Content-Type, Accept”);

I did have the login working from the basic Vue-OKTA guide on the OKTA site.

All that I really wanted to do was to get an event that I could intercept after the user logged in to get some credentials from them. Is there a way to do that?