The client is able to authenticate using hello.js to facebook and send the access token back to the server which then does a get graph.facebook.com/me?access_token=xx
and if it is correct returns the user's profile info.
I want to do the same for Twitter but even after reading the documentation I don't understand which endpoint I should hit.Is it possible to do it with a REST call?
You need to hit this endpoint
https://dev.twitter.com/rest/reference/get/account/verify_credentials
like that (using the request module):
const oauth={
consumer_key:config.get('twitter.consumerKey'),
consumer_secret:config.get('twitter.consumerSecret'),
token:oauthToken,
token_secret:oauthTokenSecret
}
requestAsync({
url:'https://api.twitter.com/1.1/account/verify_credentials.json',
method:'GET',
oauth,
})