Where can I find "YOUR_APP_USER_TOKEN"?
See original GitHub issueHi there! Iâm new to this, this is the first time Iâm trying to use this library. Can you help me to figure out where I can find âYOUR_APP_USER_TOKENâ?
I have copy-pasted the code from the README (with minor changes):
import { TwitterApi } from 'twitter-api-v2'
// Instanciate with desired auth type (here's Bearer v2 auth)
const twitterClient = new TwitterApi(<YOUR_APP_USER_TOKEN>)
// Play with the built in methods
const user = await roClient.v2.userByUsername('plhery')
console.log('user', user)
const tweet = await twitterClient.v1.tweet('Hello, this is a test.')
console.log(tweet)
// You can upload media easily!
const image = await twitterClient.v1.uploadMedia('./format-your-writing-for-readability.jpg')
But I canât seem to figure out where to get the user token, the only keys I see in my developer portal are these:

Where can I get the user token? Whatâs the easiest way to obtain it?
(My goal is to post tweets using this api, not just read data, I donât know if that matters.)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Manage API tokens for your Atlassian account
API tokens can be used with the Jira Cloud and Confluence Cloud REST APIs. If you're using Bitbucket Cloud, see App passwords. Create...
Read more >User Token authentication Spring MVC RESTful API
User does an initial request to the API to obtain an access token (must provide own credentials - login and password) ¡ Service...
Read more >User Token REST API - v2 - Sonatype Help
A user token is a pair of a userCode and a passCode unique to the user, which will grant the permissions that are...
Read more >Access Tokens - Auth0
Describes how access tokens are used in token-based authentication to allow an application to access an API after a user successfully authenticates and ......
Read more >userToken API parameter - Algolia
The insights taken from this could be used in combination with personalization for example. The user token has to be an alpha-numeric string ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi,
So, youâre new to Twitter development? đ You now have multiple authentication methods on this API.
Donât forget to generate them with read and write permissions.
If you want to implement a login flow âa sign in with Twitter flowâ, I highly recommend you to read Twitter documentation and library doc about auth.
Thank you! The second question is resolved, just always using
authenticateworks, thatâs exactly what I want (for some reason I initially assumed that you have to first useauthorizeand only then useauthenticate, but when you just useauthenticateit prompts the user to authorize the app when they log in for the first time).Iâm still struggling to obtain the userâs email address though.
Iâve tried both:
and
And it returns some info about the user, but no email.
I see that the first link you gave me mentions returning the email if âRequest email addresses from usersâ is checked, and I did check it, but I still donât see the email in the response. I donât think Iâm using this correctlyâŚ
Can you help me to figure out how to obtain the email?
Edit:
I have also tried this:
But it returns me a bunch of html with an error, says âNothing to see here, looks like this page doesnât existâ.
Edit 2:
Doing this:
doesnât give me an error, it gives me a response, but thereâs still no email in itâŚ
Edit 3: Yissss!!! That did it:
Got the email. Case closed =)
Amazing. Thank you so much for this amazing project, and for your help!