draftbit / twitter-lite

A tiny, full-featured, flexible client / server library for the Twitter API

Home Page:https://npm.im/twitter-lite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getting type errors with TokenResponse

hedcet opened this issue · comments

commented

I'm getting some type error with the destructuring assignment

Screenshot 2020-07-31 at 3 56 18 AM

maybe error in here https://github.com/draftbit/twitter-lite/blob/master/index.d.ts#L158

Please try this:

const oauthResult = await client.getRequestToken(callbackUrl)

if (oauthResult.oauth_callback_confirmed === 'true') {
  // in this scope you can access oauth_token and oauth_token_secret
  console.log(oauthResult.oauth_token)
} else {
  // in this scope oauth_token and oauth_token_secret are not available
  throw new Error('oauth_callback_confirmed is not "true".')
}