Twitter API: post on behalf of whom? - twitter

I want to use Twitter API so my program can post some tweets. To use it I have to register application in dev-center and get some parameters like "Consumer key", "Consumer secret" etc. Then I can use either REST API, or some libraries like twitter4j - OK, that's simple.
But the question is: who will be the "author" of such tweets? Or, in other words, where can I find them after posting? Will they be posted by application or by some user? I can't really figure out how particular user binds to registered API-application... Or how can I specify ("log-in") user to post tweet on behalf of?

The "author" is always going to be the authenticating user. From the Twitter API documentation for statuses/update:
Updates the authenticating user's current status, also known as tweeting.
To answer your other question about authenticating with another user's username/password, it is possible but you need to get permission from Twitter. You also still need to use OAuth. Check out the Twitter API OAuth documentation.

You need to have a twitter account to register your application. So your account will be the author of your posts.

Related

How to use instagram API for Login

I have been trying to implement the OAuth flow for Instagram login with Instagram official APIs but seems like a lot has changed since June 2020 and I haven't had any luck to get any help for the Instagram Oauth login flow that can return a user email which can later be used to keep track of the user registration via Instagram API.
Instagram official documentation says that they don't recommend using Instagram Basic Display API for login here:
https://developers.facebook.com/docs/instagram-basic-display-api
Can someone guide me on how to get the user information like email or at least username in return from the Instagram API.
Any help will be highly appreciated. Thanks
Unfortunately currently it is not possible to do with IG Basic Display API.
Please check the Documentation
It is not possible to get an email from Basic Display API. You will not be able to get the email from the API responses.
You can get the user ID from Instagram when you will exchange the code obtained via Authenticate to access token. Later on when you will have the valid access token you can get the username.
I would recommend checking out Getting Started from that API: https://developers.facebook.com/docs/instagram-basic-display-api/getting-started it shows how to get user_id (step 5) and username (step 6).

LinkedIn company feed/updates in v2 API

I would like to show a company's feed/updates/post on a website. I am the owner/admin of the LinkedIn page. Most of the related questions are old and uses V1. This similar questions also seems unanswered (LinkedIn Company Feed in API v2?). LinkedIn support are of no help and they instruct me to ask questions on Stackoverflow.
I created an App on LinkedIn and they assigned default permissions (r_emailaddress, r_liteprofile, w_member_social). But these permissions are of no use to me since I just want to show the company feeds on the website. Neither I want any user to login to LinkedIn nor I want to read the users/visitors email addresses or profile. Already went through a lot of their documentation but there is no clear mentioning of how to do this.
I read that company updates can be retrieved using the /ugcPosts API. GET https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(url-encoded organization Urn). But in order to do that I need r_organization_social permission. How to get this permission?
Also in this scenario, since I just want to retrieve company posts, I can use 2 legged oauth: https://learn.microsoft.com/en-us/linkedin/shared/authentication/client-credentials-flow?context=linkedin/context instead of 3 legged oauth. But when I try to generate access token I get error "access_denied: This application is not allowed to create application tokens"
https://www.linkedin.com/oauth/v2/accessToken?grant_type=client_credentials&client_id=xxxxx&client_secret=xxxxx&redirect_uri=http://xxxxx.local/&state=fasdfasdfs
Does anyone know how to achieve this?
Thanks!
You need to apply for the LinkedIn Marketing Partner Program. You can do so by adding this product to the app you have created.
Once you have access, you can read the company feed using the following API endpoint:
https://api.linkedin.com/v2/shares?q=owners&owners=urn:li:organization:12345&sharesPerOwner=100&count=25
Hope this helps.

How do I generate a link that requests access to read non-public sheet using the google-drive api?

My company is trying to get requests to access non-public user sheets. Here is how we want to go about it:
The user receives a link which contains all the necessary authentication information , and when they open the link, it gives them an alert saying something like "Grant client_id/client_email access to google_sheet"?, and when they click "yes", we get access to read the dataset?
is something like this possible with the google-drive api ?
I have looked at the google-sheet api here and the google-drive-sdk here , but I have not found what I am looking for.
When your application requests non-public user data, it must include an authorization token. The token also identifies your application to Google. Check this Google documentation. Requests to the Google Sheets API for non-public user data must be authorized by an authenticated user. The details of the authorization process, or "flow," for OAuth 2.0 vary somewhat depending on what kind of application you're writing. Check this example.

How can My App Tweet the Contents a User Submits?

Note: I am posting this because I don't even know what to Google search. I know we're all about thorough research before asking these questions. Any help would be appreciated.
Scenario: User writes a text post from my app and when they submit it, the content is added to a Parse.com class (I know how to do this) and simultaneously it is tweeted from a designated twitter account (that does not belong to the user) let's say #MyCoolAppThatTweets.
In other words, I don't want the user via my app to be permanently logged into #MyCoolAppThatTweets twitter account, but have one-time access to send a tweet from it.
Another way to phrase this question would be: How can my app log into a specific twitter account whose credentials I can "bake" into the app without compromising the security of that twitter account.
I am already aware that normally, users of an iOS app wouldn't automatically want their content being tweeted. For the project I'm making, this is not going to be a concern (it's a secret).
If you need more information or if I need to post this elsewhere, please let me know!
From your question I am not sure if you are familiar with "Twitter part" of Parse.com and Twitter REST API. If not please start by reading this https://www.parse.com/docs/ios/guide#users-twitter-users (or take a look on official Twitter way by using their plugin called Fabric: https://dev.twitter.com/)
Since you mentioned PFUser I will describe you how to achieve it by using Parse.com API.
First your user must be logged in to Twitter account.
I suppose that your user is already logged in into your app as a PFUser so best way to log him into some Twitter account is by linking Twitter account with existing PFUser - https://www.parse.com/docs/ios/guide#users-linking.
After that you can post tweets through user's Twitter account (if permission was granted). I recommend doing that using Parse.com Twitter API calls https://www.parse.com/docs/ios/guide#users-login-amp-signup. To create API requests you need official Twitter REST API which can be obtained here https://dev.twitter.com/docs/api.

Registration for own site viat twitter

anyone knows if it is possible to do registration via twitter just like facebook register (http://developers.facebook.com/docs/plugins/registration/)?
it is not login via twitter. i need to store some basic information from the twitter user, eg, name and email, and then request user to choose their own username and password for my site.
Thanks!
Twitter doesn't have this functionality at all , they have #anywhere for integration for some Twitter features on your website. That's the closest there is to this. What you can do is register an account with the information you gather from an authenticating user, but the development of this would be up to you. There are no boxed up solutions right now from Twitter. There may be something third party but I'm not aware of any.
It's also "against the rules"
You may not use Twitter Content or other data collected from end users
of your Client to create or maintain a separate status update or
social network database or service.
https://dev.twitter.com/terms/api-terms

Resources