PHP TwitterOAuth account/verify_credentials returning 401 - php

I'm using abraham's twitter oauth class (https://github.com/abraham/twitteroauth) to connect and update twitter. I had it working during testing but now I'm trying to put it onto my live server I'm getting a 401 Could Not Authenticate error.
The original connection works ok (200 response) but when I use $connection->get('account/verify_credentials'); it just 401's and says it cannot authenticate.
From looking at the $connection object, the [consumer] callback_url property is blank. Could this be the problem?
Cheers

Apparently I didnt need to be running this unless I've already authenticated once through twitter, for some reason I was trying to run this directly after connecting, obviously there were no auth tokens so it wouldn't authenticate.
Silly me.

Related

LinkedIn login API gives Access Forbidden 403 in step 3

So I have been following the tutorial to set up a LinkedIn login for my website.
I am able to do first two steps with ease and I get the authorization code.
Now I have to send HTTP POST and get JSON response to complete my LinkedIn API. I used following method to do same but I am getting an error.
Warning: file_get_contents(http://www.linkedin.com): failed to open
stream: HTTP request failed! HTTP/1.0 403 Forbidden in
D:\xampp\htdocs\LinkedIn\index.php on line 22 bool(false)
Can Anyone tell me what am I possibly doing wrong or alternative workaround?
2 Years back i worked on linkedin login but it didn't work for me too.
I suggest instead using OAuth login try with javascript SDK.
linkedin login SDK
http to https could also the reason for access forbidden because OAuth hits a server to server request which is basically http to https.
Hope this will help.

Pinterest API - 403 error when requesting access token on Dreamhost server

I'm using this php wrapper, successfully getting a code from pinterest using the link generated according to the docs:
$loginurl = $pinterest->auth->getLoginUrl($callback_url, array('read_public'));
Then when I run this:
$token = $pinterest->auth->getOAuthToken($_GET['code']);
It works fine on my local server, but when I try to run it on our Dreamhost server, I get:
Pinterest error (code: 403) with message: Forbidden
I looked through the error documentation Pinterest supplies, but I can't find anything relating to 403 errors when retrieving oauth tokens.
The only two places I've seen mention of 403 errors when requesting oauth tokens from Pinterest's API have concluded that Pinterest is blocking the ips or the user agent string.
I've tried manually overriding the user agent string to no avail.
I've tried contacting Pinterest to find out if there is anything I'm missing and they directed me here.
Make sure the Dreamhost server is using an HTTPS URL e.g. is using TLS. That could be the reason why you get a 403.

Wechat : Sandbox API config Failed

Hi please support to troubleshoot the below error in Wechat Sandbox API Config:
I am integrating Wechat API in PHP application. I have created a test account in Wechat Sandbox API. But when configuring the API with URL and token its shows "Unable to configure".
When checking the ajax response it throws : {"errcode":-106,"errmsg":"token check fail"}
Thank you.
I got the "Unable to configure" message when testing the Getting Started wiki sample too. Trying to reach wx_sample.php returned a 500 Internal Server Error.
It was fixed after changing the owners for my directory and file, after that the token could be set in the sandbox - 'API Config'.

SurveyMonkey: Cannot access Token using OAuth

I'm new to OAuth and I need help in accessing the Survey Monkey API to get the auth token. I tried using login_with_surveymonkey.php code and changed the client_id, client_secret, and api_key (https://developer.surveymonkey.com/apps/mykeys). It is giving me this error message:
'it was not possible to open the OAuth access token URL: could not resolve the host domain "api.surveymonkey.net"'
I tried running it on our dev environment and the error returned changed: 'it was not possible to access the OAuth access token: it was returned an unexpected response status 401 Response: {"error_description": "Invalid client_id/client_secret/api_key", "error": "invalid_client"}'
However, when I used the io-docs (https://developer.surveymonkey.com/io-docs) using the same client_id, client_secret, and api_key, I was able to connect to retrieve a token. I have curl working on my local machine.
Am I missing something?
Thanks!
The IO Docs API console does not actually perform OAuth correctly and is unfortunately not a good model on how to do OAuth - we have a replacement coming very soon.
The source code for that PHP OAuth implementation looks good, so I would check the following things:
client_id is your Mashery username
client_secret is a 32 character long secret associated with the api key you are providing - you can view it here https://developer.surveymonkey.com/apps/mykeys
Edit: According to our logs, it looks like you've solved this problem, correct? I think you were providing the api_key as the client_secret.

file_get_contents authentication gives '401 Access Denied Error'

I am trying to create a database in cpanel using the folowing comment
$result =file_get_contents("http://$cpanel_user:$cpanel_password#$cpanel_host:2082/frontend/$cpanel_skin/sql/adddb.html?db=$db_name")
echo $result;
this command gives me HTTP request failed! HTTP/1.1 401 Access Denied error. I have used the correct password and username for connecting. And i am able to create the database when i give this url(url in this format) in a browsers url field.
Can someone explain what seems to be the problem?
That is not the correct way to create databases using cPanel. I believe you are trying to replicate the form inside cPanel to create databases, which is not correct.
Also, you will not be able to create databases using your cPanel username and password. I think you should refer to this thread to resolve your issue.

Categories