Posting information on Twitter with a known username / pass and Oauth token without providing access

I use C # to create some features for a website. They want to twitter a message to their account when they add a new vacancy to their site. I am faced with the problem that when I try to do this using the OAuth token approach, I have to provide access to the application every time. I want all this to work automatically, without the need for permission. Can I log in to the user’s system and then just send a message or how do I approach this?

+3
source share
1 answer

With OAuth, you only need to get your permission once, and you can save the access token that Twitter returns to you and use it to work on behalf of the user, if the user does not refuse permission to act on them on behalf of or the token does not expire. Twitter currently does not pass tokens, see the Twitter OAuth FAQ .

Just save the token next to the username in the database and use it to send mail requests whenever you need to send a message to Twitter.

Twitter does this in this Transition from Basic Auth to the OAuth Guide :

Prepare Long-Term Storage for Access Tokens and Secrets

, oauth_token oauth_token_secret ( " " ) , Oauth_token_secret . , , API Twitter, , . OAuth, .

0

Source: https://habr.com/ru/post/1766147/


All Articles