Hello, i implemented the Sign in with twitter as this tutorial shows.
I fail to get all the parameters i need as soon as the callback is made on step 2.
This is step 1 code on my server:
if (!req.body.oauth_token || !req.body.oauth_verifier) {
let requestTokenOauth = {
consumer_key: self.twitter.consumer_key,
consumer_secret: self.twitter.consumer_secret,
callback: req.body.redirectUri + '?contractId=' + contractId
};
//Step 1 - send OAuth token back to authorization screen
Request.post({ url: requestTokenUrl, oauth: requestTokenOauth }, function(err, response, body) {
let oauthToken = QueryString.parse(body);
//Step 2. Send OAuth token back to open the authorization screen.
res.send(oauthToken);
});
}
That contractId is there because it is useful for my app. I dont think it is interfering with anything.
This is my code to open the popup:
return this.http.post('/api/twitter/authenticate', JSON.stringify(defaults), {}).subscribe((value: any) => {
let parsedBody = JSON.parse(value._body);
let qs = '?oauth_token=' + parsedBody.oauth_token;
window.open('https://api.twitter.com/oauth/authenticate' + qs, 'Twitter Login', 'width=500,height=550');
});
After the user interaction witht he popup i get redirected to my res.body.redirectUri as expected but i do not receive the oauth_token and oauth_verifier as expected.