Search code examples
javascriptnode.jstwitteroauth-2.0axios

Making Oauth2 request to twitter api


Updated Question: I want to authenticate user in NodeJs using oauth2 request but I am unable to find any article to do it on web.

Twitter generally, and mostly people on web use oauth 1 for Authentication by I don't want to have express session middleware and also, I am curious to understand how can we authenticate user using oauth when they don't have passport strategy and so on.

Can someone please help me in figuring out how we can authenticate user in twitter using their docs (with code and possibly axios)?

link for their docs


Solution

  • It is currently not possible to authenticate a user with OAuth2. On the documentation page you've linked to (which details POST oauth2/token)

    Allows a registered application to obtain an OAuth 2 Bearer Token, which can be used to make API requests on an application's own behalf, without a user context. This is called Application-only authentication.

    (emphasis mine)