So, I figured out a solution to this.
Sending a 302 Redirect from the server back to the client is not the way to do this. What I did instead was: send the full url for the oauth/authenticate API call (ie, https://api.twitter.com/oauth/authenticate?oauth_token=xxxxxxxxxxx) back to the client. Then, have the client take the body of that, and manually set window.location to the received url. Here’s the sample of the client-side javascript:
const loginButton = document.getElementById('login-button');
loginButton.addEventListener('click', event => {
fetch('twitter/login')
.then(res => res.text())
.then(url => {
window.location = url;
});
});
Possibly not ideal, but it works and doesn’t seem to cause any problems. I spent too long spinning my wheels on this, so I’m sure this can help somebody. 