Can't retrieve oauth_verifier

oauth

#1

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.


#2

So body does not have a value like this? What does it have? What is the status code of the response?

oauth_token=NPcudxy0yU5T3tBzho7iCotZ3cnetKwcTIRlX0iwRl0&
oauth_token_secret=veNRnAWe6inFuo8o2u8SLLZLjolYDmDP7SzL0YfYI&
oauth_callback_confirmed=true

#3

I tried to capture the http packages on my server with wireshark and i found out that i was receiving 2 requests as soon as the popup is closed.

One to http://localhost:4200/#/account?oauth_token=xxx&oauth_verifier=xxx
And another to http://localhost:4200/#/account?contractId=xxxx

Is this a normal behaviour?


#4

i receive those as an answer to my post. My problem is with the popup callback.