Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Twitter API Twitter asking for user permission each time

SOLUTION:- Twitter Login API Asking for  user's authorize permission each time


When we integrate Twitter login in NodeJS, PHP, express, react, Fastify or any framework, we face an issue like if a user is logged in by using twitter OAuth and granted permission to access twitter profile data, and if he logged out from our site try to login again, twitter ask for permission each time. So today we solve this problem by using a simple change


Open your code and find https://twitter.com/oauth/authorize?oauth_token= in your code. this is the URL where we redirect to the user after clicking on 'Login with twitter' in our website, and here we are using authorize() function of twitter API that functions always ask for permission to the user each time he tries to log in, so instead of authorizing function we will use authenticate() that will check if a user is already logged in then it will not show permission popup and redirect the user to callback URL.

To Replace

https://twitter.com/oauth/authorize?oauth_token=YOURTOKEN

with

https://twitter.com/oauth/authenticate?oauth_token=YOURTOKEN




You can check twitter API for more details in twitter documentation https://developer.twitter.com/en/docs/basics/authentication/api-reference/authenticate

Important Links

Twitter API requests the user's permission each time?

Prevent APP Permission in Twitter Login API 

Solution for Twitter asking for app authorization each time user logs in



This post first appeared on Thecoderain PHP,wordpress,cakephp,codeigniter,js, Jquery, Ajax Free Tutorials, please read the originial post: here

Share the post

Twitter API Twitter asking for user permission each time

×

Subscribe to Thecoderain Php,wordpress,cakephp,codeigniter,js, Jquery, Ajax Free Tutorials

Get updates delivered right to your inbox!

Thank you for your subscription

×