Twitter OAuth Values - oauth

My goal is to post a comment on a user's twitter page. Here I have this php code...
$connection = new tmhOAuth(array(
'consumer_key' => 'CONSUMER_KEY',
'consumer_secret' => 'CONSUMER_SECRET',
'user_token' => 'USER_TOKEN',
'user_secret' => 'USER_SECRET',
));
Is the consumer key and consumer secret the values I get when creating an application from https://dev.twitter.com/apps ?
Then the user token and user secret would be the person twitter account that i'm trying to post a comment on?
I created a dev twitter application and put in the consumer key/secret from the OAuth settings, and create my access token and put the "Access token" and "Access token secret" as the users. Then when running the script, it gave me a Response code:401
Any ideas? Thanks in advance.

Solved my own question. If anyone cares, you have to go to your application and go to the settings page to make sure it has read and write access.

Related

Can not get QuickBooks API accessTokenKey for OAuth 2.0 authorization

I am new in Quickbooks and want to use the API by OAuth 2.0 protocol. For that, I did the following steps according to Quickbooks docs.
I have created an Intuit Developer account.
I have created an application for testing purposes.
I got OAuth keys for my test application.
I want to do API requests by using PHP SDK provided by Quickbooks and I started to use code according to the instructions of PHP SDK:
require "vendor/autoload.php";
use QuickBooksOnline\API\DataService\DataService;
$dataService = DataService::Configure(array(
'auth_mode' => 'oauth2',
'ClientID' => "Q0lCkcEshsGMHOEula2r5RKc2yhxvMsYEpKN1lw1WZwyfd1Si6",
'ClientSecret' => "gE0F9hLgwx9OBzRpNxyOvWJH6L2fIhzAwBugPJHq",
'accessTokenKey' => 'eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..4z4Assj4x1qt8H4DtQco6A.nmV2jTxaDMVdFWEUO16q5qhbd5aD6U-U-RYnSNywqg-HPC_3_jvwpMJU1a1S5X-PgPUy60WvVy_8p1awY7kIoFzTV4IhdFLrZpYtBUGCjcsvjxWeOSgP6oCayBEmCv7zzabtgB6vxU46jQqKX2IXYUGPPtyYO64hrgELFR4SKUK6boZiVnh8z19gnvsReKMmIINA3-NgC6QJqMRp6HWgzCa9RuDN9tCtrAK2dy5xmJRNSNgdv_gyg1bfdX4l4b30fLPzFk31fsTT9NTJq9PuGtdTsvUuCj7Hme6HPldD9TKYRXWU8TKrQQrQWEpdlbPr6F3rhP6IdmCv9t1XH_WzF_1IseRUoYhiTUjubig-j8gzwajIdYQTzpJQKJ92QiAEyt8k40WWg0v69hEC0w7WRBuUE-IJ50xWypqS_P28IWt1G14rovZ97soGOteSik-41g1icR2zxfNhXGq7zO7oU5B8r-ej5Pb52T0MCMktgd6y32bqwo2pcEzblL2bZs7DZ7LDx5peY4TIfGW21crTE6xjhRr7LdqB8K505pRqIOP20eaRgwtGHLZ3bdBt1_negw2AGjc409BM0nLzzmODxr3yo-YdGwkcOjm5QgbGAsrnpoSo9tSpxPHoN0vMRneRdsKCd6CZG5M1OIOMuj7spkm442tvwiAMCx2Fh-STG6fMnhOq7l_f8NW_3kscxtF2.obQxJKjPfi1KlaQQ_OUoNg',
'refreshTokenKey' => "L011509163184Q0K7DT40SVXhJXAfyoj6B6EbSr3Ty64yVvF5A",
'QBORealmID' => "123145857569084",
'baseUrl' => "https://sandbox-quickbooks.api.intuit.com"
));
I am stacked on getting accessTokenKey in order to complete configurations and start to do API requests. QuickBooks provides a tool named OAuth Playground here for getting accessTokenKey. I put Client ID and Client Secret from Application's Keys as Consumer Key and Consumer Secret in the OAuth Playground's screen and press Connect to QiuckBooks but it gives me this error:
We were unable to process your request.
This error can occur when too much time has passed in the request. We have been notified of the problem and will investigate further.
Please contact us for further assistance.
Error Id: cxgdknrkjzppmjifkv2ipsgp-29491421
Could anyone help me with this error?
. The OAuth playground you are using is only used to generate OAuth 1.0 values, not for OAuth2.0.
Consumer key and Consumer Secret is the OAuth 1.0 idea, whereas ClientID and CLientSecret is for OAuth2.
https://help.developer.intuit.com/s/question/0D50f00004wJ1S0CAK/can-not-get-quickbooks-api-accesstokenkey-for-oauth-20-authorization

Getting invalid oauth access token: where is the token I need?

I would like help obtaining/locating the correct access_token value for an API call.
I'm configuring an application that wants to search Facebook using the graph-api search request at https://graph.facebook.com/fql, for which I need an access_token. The application is a backend server so there's no UI and no users.
I registered a new 'app' using the developer pages 'Create a New App' link, so I now have an app at: https://developers.facebook.com/apps/<> and from that I get an 'app secret' token. Digging into the Advanced settings page for the app there is also a Client token.
However using either token results in the following JSON error:
{"error":{"message":"Invalid OAuth access token.","type":"OAuthException","code":190}}
Can anyone point me to where I've gone wrong?
==
The following 'curl' request demonstrates the command working correctly, but it's only usable token-less like this occasionally, so the app needs &access_token=...stuff... adding to the parameters.
$ curl 'https://graph.facebook.com/fql?q=select%20url,%20share_count,%20like_count,%20comment_count,%20click_count,%20total_count%20from%20link_stat%20where%20url%20=%20"http%253A%252F%252Felifesciences.org%252Fcontent%252F2%252Fe01233"'
{"data":[{"url":"http\u00253A\u00252F\u00252Felifesciences.org\u00252Fcontent\u00252F2\u00252Fe01233","share_count":0,"like_count":0,"comment_count":0,"click_count":0,"total_count":0}]}
The 'app secret' and 'Client token' will not work.
What you need is an Access Token, refer to this.

Is there a way to get Foursquare photos without oauth token. (with only App_ID, and App_Secret)?

The documentation says this request does not require an acting user, but it will only work with an acting user: https://api.foursquare.com/v2/venues/43695300f964a5208c291fe3/photos
The documentation says that it doesn't need an 'acting user' but if you click the 'Learn More' link right next to it in the docs, you can see that you still have to provide a client_id and a client_secret of your app. After you created an app you can use the Client ID and Secret to execute the following request:
https://api.foursquare.com/v2/venues/43695300f964a5208c291fe3/photos?client_id=INSERT_CLIENT_ID_HERE&client_secret=INSERT_CLIENT_SECRET_HERE&v=20140130

Request Google Contacts After Successful Omniauth Authentication Rails

I am having trouble figuring out how to make a request to the Google Contacts API after a successful authentication.
provider :google_oauth2, "key", "secret", :scope => "userinfo.profile,https://www.google.com/m8/feeds", :approval_prompt => 'auto'
This successfully authenticates the user with permission to access the contact api.
My question is - how do I make the next request to actually get the contacts using the refresh token and other information provided by:
request.env['omniauth.auth']
I've read that you need to specify specific headers like GData-Version => 3.0 but can't seem to figure out how the entire request would look like.
Thank you!

Create facebook session when Uid and authtoken is received

I have to work on mobile api ,the purpose is to use facebook connect to login and send required data to access the api.
For testing now user provides us with hard coded values of auth token and Uid,so how can i create a session for the user.I'm using facebooker gem ,rails 2.3.4 and ruby 1.8.7.
For this you have to need the access_token with offline_access permission, because these access_token hasn't expires time. In PHP, there is a function named setAccessToken(), in this you can set your access token(which has offline_access permission). Below is the code for PHP( Sorry, I don't know about the RoR)
require "facebook.php";
$facebook = new Facebook(array(
'appId' => YOUR_APP_ID,
'secret' => YOUR_APP_SECRET,
));
$facebook->setAccessToken("...");

Resources