CORS error persists in oAuth even after setting header

Because it seems you are not redirecting the user to Twitch.

You seem to be using a lib to fetch the URL instead of redirecting.

It may also be a bug with passport since you are using passport

here is a “more simple” example

You have a / missing as the redirect URL is invalid a missing / between 3000 and auth

This section is also wrong.

You’ve got a load of weirdness going on here. And I don’t know if the issue is with PassportJS or something you have done.

For User oAuth authentication

  1. Generate a URL with scopes/etc as needed using response_type=code
  2. Display that URL to the user in the web browser or redirect them to that URL
  3. They will accept/decline the authorisation
  4. They come back with a code exchange the code for an access token/refresh token key pair

You don’t need the kraken v5 header with helix