When using simple request to post to Twitter the messages are signed with "sent from API". Is there a way to change that to the actual name of your application? Is it another post parameter or something else?
This is covered in the Twitter API FAQ
If you would like tweets from your application to recieve a source parameter, please register an application and implement OAuth authentication. We will automatically include your application as the source for any tweets sent from your application.
If you are writing a desktop Twitter client and you want your application's name to show up instead of "From API", you have to use OAUth.
If you want to use OAuth in your desktop Twitter application, you have to go through Twitter's PIN workflow (i.e., sending the user to the Twitter website to authenticate).
The confirmation step is part of the reason Twitter is using OAuth. There's no getting around it.
There are several libraries out there that implement OAuth for Twitter so you're not reinventing the wheel.
If you want example on how to use OAuth and Twitter I have it in my blog
"If you are writing a desktop Twitter client and you want your application's name to show up instead of "From API", you have to use OAUth.
If you want to use OAuth in your desktop Twitter application, you have to go through Twitter's PIN workflow (i.e., sending the user to the Twitter website to authenticate)."
Hold on a moment, how do Twitter clients manage to put their client name in the "via" without you logging in somewhere and copying a PIN back to the application.
I just want a command line client that updates my status and prints "via MyApp". Am I missing something here?
(I might be, I've only started trying to figure this out yesterday)
In fact if the user isn't authenticated, I don't want to get them to login elsewhere and copy/paste a PIN, I want them to type their user/pass into my application. Like what happens with all the twitter clients I've seen...
Related
Everything I have read (e.g. https://api.slack.com/docs/oauth) makes it seem as though I can only build an app that integrates with a Slack team I manage. E.g. I have to create my Slack Client ID .. etc ... and then I can oAuth users for my team.
What I want to do is allow my app's users to login to my app using their Slack login (for their Slack team I do not control or have access to.) I don't want to force my users to generate a Client ID to use my app. I want them to login the same way Google Login or Facebook Login works.
The closest thing I have found is a "login with slack" HTML button, but I'd like to do it in iOS using Swift.
Is that possible?
Sadly, that's not possible. For google or facebook, the way authentication works is that they provide you a mobile API which handles the communication between your app and their web service. So you task is simply adopt that API, make simple function call and retrieve information for user from the API. For example, the facebook button is provided by the API.
However from a look at slack site, they only have RESTful API documented. So in this case, you have to handle the passing and storing of parameters by yourself, and send HTTP request manually. You can have a look at Alamofire framework, which is the best choice for making HTTP request. Basically, you have to send needed parameter with the specific url though HTTP request to perform a log in action, and you have to parse the respond data and then see if the login is successful or not, etc
Thanks to some help from friends it looks like the answer is yes.
You must first make sure you "Distribute App"
Then set up the permissions you require and "install app" (which is a bit not "smart" since you can accidentally add conflicting permissions and get an error when trying to install).
Once that is done you will get an Auth Token and can make requests for any user to login using oAuth.
You can also trigger a sign in request like so:
https://slack.com/oauth/authorize?client_id=[client id]&scope=identity.basic
Edit: For future Googlers, Slack now also provides a specific documentation page for this type of OAuth grant/login: Sign in with Slack
I would like to tweet via rest but I'm not sure what kind of OAuth I need.
https://dev.twitter.com/oauth/overview
There are plenty of OAuth types. But every time I see that user have to go to the web site and coppy pin(PIN-based OAuth) or go to the web page to sign in or click or something.
So my question is: is it possible to tweet something using only command-line application? (I dont like to use framekorks which are specially prepared for twitter like twitter4j etc)
If you just wanna post tweet from a command line then maybe https://github.com/sferik/t can help you. Regards
As documented here https://dev.twitter.com/rest/reference/post/statuses/update the endpoint to tweet requires authentication. For this you require a token tied to a specific user.
You have 2 options
1) Generate and store a token beforehand, this is the "Tokens from dev.twitter.com" option in the link you sent.
2) Ask a user to authenticate when you want to tweet for them. This is "3-legged OAuth" or "PIN-based OAuth". You can also then store this token for reuse, and switch between tokens in your own code to post as different users. But it generally relies on a user being logged into Twitter via a browser to click approve at some point before you want to tweet.
My project oksocial has support for either approach, after which you can post with
oksocial -d "status=my message to the world" https://api.twitter.com/1.1/statuses/home_timeline.json
or even specify the user token and client secrets on the command line
oksocial --token username,consumerKey,consumerSecret,token,secret -d "status=my message to the world" https://api.twitter.com/1.1/statuses/home_timeline.json
I'm writing an API for our product and I'm trying to understand how some basic OAuth works with regards to mobile apps that might leverage our (to be created) api.
Lets imagine that our website currently allows a person to LogIn to our site via Twitter OAuth.
On the callback from Twitter, our server retrieves the twitter OAuth result and if all good, then checks to see
if this user already exists in our DB (eg. lets assume the Email is the unique key). If they don't exist, we
create a new user.
Of course, we then log the user 'in', which means we create a cookie for them, for their browser.
So far - nothing new here. All normal stuff.
Now .. if we want to do this via an iPhone or Windows phone using their native language and the app's use our API, i'm not sure of the point where OAuth ends and our API takes over?
For example, lets pretend it's an iPhone app that takes advantage of our API.
The iPhone app will try to authenticate the user against their Twitter cred's. Ok, fine. But when it callsback, it's back in the phone, right? Not our servers. So then the app needs to try and create a new user? So then the iPhone might try and call /api/CreateAccount. But this means -anyone- can call this api? And how does the website really know they have authenticated? Only because the app says so? What's to stop the person from creating a malicious app and calling our API by flooding it with new account creations? And what about authentication to api resources? Forms Authentication isn't available here. So do people use querystring authentication over SSL for api calls? How does the iphone authenticate with -our- server?
I'm so confused.
Can anyone please explain the differences and common practices people are doing these days when they have a website and an api .. and use OAuth as the authentication mechanism, please?
The naive app would call not CreateAccount, but VerifyAccount with twitter's oauth set of data so you site and API could verify it. The site would respond with a unique userID and your iOS app would use that as it's internal user id. More info.
i am using oAuth method for login to twitter in iPhone application... it need two steps to allow me to post. first is username and password authentication after validating it, twitter provides pin number to authorize... then i copy or memorize and send to twitter for authorize me to post for each and every time i login to twitter.
is it possible to post to twitter without entering pin number or copy the pin number provided by twitter and send the token internally without copy or mermorizing...
Thanks and regards
venkat.
Yes, it is possible using xauth
You need to get approval to use xauth:
xAuth access is restricted to approved
applications. If your application is a
desktop or mobile application and the
standard web OAuth flow or PIN-code
out-of-band flow is not right for you,
send a detailed message to
api#twitter.com to request xAuth
privileges.
I'm trying to make an application that can connecto to facebook. I've found Facebook Connect for iPhone and I don't like the login form that it has.
Is there any way to make a custom login form? Is there some api functions to call to login an user on Facebook?
Thank you.
I would recommend not going this route. I'd be suspicious of any app that's asking for credentials that's not using the de-facto standard login control. If there is no standard control, then I have to take my chances with whatever the app presents, but in the case of Facebook, the standard control is part of Facebook Connect.
Just use one of the other API's such as the REST API and then create your own UI to capture the login credentials and call the REST API to login.