LinkedIn OAuth redirect login returning "No 'Access-Control-Allow-Origin' header is present on the requested resource" error
https://www.linkedin.com/oauth/v2/authorization responses apparently don’t include the
https://www.linkedin.com/oauth/v2/authorization and get responses back successfully.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS explains in more detail but the gist of it is that for CORS, the server the request is being sent to must be configured to send the
Access-Control-Allow-Origin response header, nor your own backend server.
The current state of things seems to be that when needing to do LinkedIn authorization, you’ll have to initiate the request from your backend code. There’s no way you can do it from your frontend code, because LinkedIn no longer provides any support for it at all.
LinkedIn did previously provide some support for handling it from frontend code. But the page that documented it, https://developer.linkedin.com/docs/getting-started-js-sdk, now has this notice:
And https://engineering.linkedin.com/blog/2018/12/developer-program-updates has this:
So the remainder of this answer (from 2017-06-13, almost 2 years ago, at the time of this update) has now become obsolete. But it’s preserved below for the sake of keeping the history complete.
2017-06-13 details, now obsoleted
Anyway https://developer.linkedin.com/docs/getting-started-js-sdk has official docs that explain how to request authorization for a user cross-origin, which appears to be just this:
And https://developer.linkedin.com/docs/signin-with-linkedin has other docs that another auth flow: