Passport AngularJS ExpressJS: Origin null is not allowed by Access-Control-Allow-Origin Passport AngularJS ExpressJS: Origin null is not allowed by Access-Control-Allow-Origin express express

Passport AngularJS ExpressJS: Origin null is not allowed by Access-Control-Allow-Origin


I had the same problem and the only solution that I have found is to use an hyperlink (as you say in your post). I think that you can't use a ajax request for security reason. However using an hyperlink worked for me and I can authorize my users.

Why don't you use an hyperlink? Is there some problem?


You can't use an AJAX request that results in a redirect to Twitter, because authenticating with Twitter means actual user interaction, where the user has to log on to their Twitter account and grant your app access to (parts of) their account.

You're going to either have to change the browsers' location to /oauth/twitter, or create a new window with that URL (and signal back to your main window when authentication is done).


Just call your hyperlink in client code.

window.location.href=''