I am using https://twitteroauth.com/ in my some PHP pages. I want to get user access token and access secret token. I got my answer on this page: How to get user Access Token and Access Secret with the Twitter API using php
After replacing my consumer key and secret consumer key on both pages. I upload it on my server but then I got the following error when I open twitter-go.php
Fatal error: Uncaught exception `'Abraham\TwitterOAuth\TwitterOAuthException'` with message
'<?xml version="1.0" encoding="UTF-8"?>
<hash>
<error>Desktop applications only support the oauth_callback value 'oob'</error>
<request>/oauth/request_token</request>
</hash> '
in `/home/mediahyp/public_html/tweetme/twitteroauth/src/TwitterOAuth.php:138`
Stack trace:
#0 /home/mediahyp/public_html/tweetme/twitter-go.php(13): Abraham\TwitterOAuth\TwitterOAuth->oauth('oauth/request_t...', Array)
#1 {main} thrown in /home/mediahyp/public_html/tweetme/twitteroauth/src/TwitterOAuth.php on line 138
Can anyone tell me what is this error about? Am I missing something or something else.
https://twittercommunity.com/t/desktop-applications-only-support-the-oauth-callback-value-oob-oauth-request-token/252/2
The new interface simplifies this: if you provide a placeholder callback URL in the field for it in your application detail screen, it allows you to use dynamic callbacks. So just go ahead and put a placeholder in there (doesn't have to be the actual dynamic/runtime callback you use) and you'll be able to use other forms of auth.
When no placeholder is presented, the application is locked to OOB mode.
Related
I am trying to retrieve the contents of my calendar using the Outlook REST API, but I am getting weird error responses.
The code is based on the example code supplied by Microsoft in https://github.com/microsoftgraph/php-connect-rest-sample
I have created an application and specified it want access to calendar.read and changed the scope in the testcode, Constants::SCOPE, to include this scope.
After succesfully retrieving a token I can verify that the application requests and sets the correct privileges. After that I try to retrieve the events in my calendar as described at the documentation: https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations#get-series-master-and-single-events-rest
I use the Advanced REST client add-on for Chrome to create a GET request with the following specs:
Url: https://outlook.office.com/api/v2.0/me/events
Headers:
Authorization: Bearer [token]
Prefer: outlook.timezone=Europe/Berlin
The response I get is a 401 status code with the following content for the X-Ms-Diagnostics header:
2000010;reason="ErrorCode: 'PP_E_RPS_CERT_NOT_FOUND'. Message: 'Certificate cannot be found. Certificate required for the operation cannot be found.%0d%0a Internal error: spRPSTicket->ProcessToken failed. Failed to call CRPSDataCryptImpl::UnpackData:Certificate cannot be found. Certificate required for the operation cannot be found.%0d%0a Internal error: Failed to decrypt data. :Failed to get session key. RecipientId=293577. spCache->GetCacheItem returns error.:Cert Name: (null). SKI: d6c3dacffd2b3fba2fb3d6c2b0fcd78680a3acd1...'";error_category="invalid_msa_ticket"
The Www-Authenticate header specifies 'error="invalid_token"' while the token was just received.
Any idea what I am doing wrong?
I think another thing you might be able to check out is the scope when you request the v2 endpoint. for V2 endpoint, the scope is different between Graph API and outlook api. you need to specify scope as "https://outlook.office.com/calendars.read" instead of Graph scope.
I hope it will help.
Basically, the message means that the token you're trying to use is not valid for the operation.
I went through this. This is how I've solved:
I use the suggested scopes here (I was creating an event): https://msdn.microsoft.com/office/office365/APi/calendar-rest-operations#create-events
To get the authorization code I used this URL schema:
https://login.live.com/oauth20_authorize.srf?client_id=[YourClientID]&scope=[ScopeYouNeed]&response_type=code&redirect_uri=[YourRedirectURI]
Then I get the refresh & the access token. And now it's working!
You need to just change the URL from https://outlook.office.com/api/v2.0/me/events to https://graph.microsoft.com/v1.0/me/events
This is my first attempt to use the Google API, so I'm probably missing something ridiculously simple.
My API access has been turned on, I've enabled all the web based settings I could find for this feature, setup the Simple API Access and Client ID for web applications, etc.
I'm using the PHP library Google provide here: http://code.google.com/p/google-api-php-client/
As my code wasn't working, I defaulted to their sample code as getting that working usually solves my problems. I've copied their code below:
require_once '../../src/Google_Client.php';
require_once '../../src/contrib/Google_TranslateService.php';
$client = new Google_Client();
$client->setApplicationName('Translation tool');
// Visit https://code.google.com/apis/console?api=translate to generate your
// client id, client secret, and to register your redirect uri.
$client->setDeveloperKey('XXXXXXXXXXXXXXXX');
$service = new Google_TranslateService($client);
$langs = $service->languages->listLanguages();
print "<h1>Languages</h1><pre>" . print_r($langs, true) . "</pre>";
$translations = $service->translations->listTranslations('Hello', 'hi');
print "<h1>Translations</h1><pre>" . print_r($translations, true) . "</pre>";
I have:
checked the developer key, which is the API key
checked the allowed referers
Set the referers to include .DOMAIN.com/
Set the referers to include the IP address
Tried including the OAuth2 client id, secret, etc
None of these have worked. The error I'm getting in full is as follows:
Fatal error: Uncaught exception 'Google_ServiceException' with message 'Error calling GET https://www.googleapis.com/language/translate/v2/languages?key=XXXXXXXXXXXXXXXX: (403) Access Not Configured' in /home/google-api-php-client/src/io/Google_REST.php:66 Stack trace: #0 /home/google-api-php-client/src/io/Google_REST.php(36): Google_REST::decodeHttpResponse(Object(Google_HttpRequest)) #1 /home/google-api-php-client/src/service/Google_ServiceResource.php(186): Google_REST::execute(Object(Google_HttpRequest)) #2 /home/google-api-php-client/src/contrib/Google_TranslateService.php(39): Google_ServiceResource->__call('list', Array) #3 /home/google-api-php-client/examples/translate/simple.php(13): Google_LanguagesServiceResource->listLanguages() #4 {main} thrown in /home/google-api-php-client/src/io/Google_REST.php on line 66
I'm loosing the will to code with something that should be much more straight forward. Any advice to what might be the problem?
That 403 error is almost certainly related to the Simple API Key. If for example it was a usage restriction the message would say that so....
Double check and make sure you are using the Simple API key listed for server access and have it set to any IP. Specific IP should work but it may depend on how your server is set up.
You may even want to generate a new key just to make sure the one you have is valid. Specific IP would be best in the long run.
Just did the same thing working with the Custom Search API, had the browser key entered and it caused a big dent in the wall as I banged my head into it. . You Shouldn't need any of the OAuth settings just to get the basics working.
i had the same problem but with the analytics api. In my case i listed the ip of the server in the allowed ip addresses.
So when i removed all ip addresses from the google api's console allowed ip addresses then it started working.
I used snowtigerlib freelancer api, it is a php wrapper class. I downloaded the full code from this link
Then I setup SnowTigerLib_Config.inc file with my key and secret. Then I did the following step:
First it went to the following url.
Then I logged in to sandbox with my username and password.
Next step, it went the following url.
Here Authenticate API Access was authorized.
After Authorizing API access it went the following url
Here it shows that it is authorized and the automatically redirect into my callback url with following error:
ERROR
Notice: Undefined index: token in ..........\callback.php on line 4
HTTP Error: http_code:401 in ...............\SnowTigerLib.php on line 455
Details: http://api.sandbox.freelancer.com/RequestAccessToken/requestAccessToken.xml?oauth_consumer_key=7484ba1fdfa9138ec77ead0c881966ad43f194ba&oauth_nonce=5a9b4e19b1fcd551e416d8e1fa86ab50&oauth_signature=LKRcVWNRdE%2BIzAzem2svR%2F0OiG8%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1356949656&oauth_verifier=4a24c84d5b49465a51ca990e2114945894896ed6&oauth_version=1.0
Please give me reply if anybody knows this issue.
I am being randomly bugged by the following error message:
This occurs when php library tries to obtain the access token line 112.
Sometimes my code obtains access token in first try, sometimes I need to refresh the URL containing 'code' as get parameter multiple times before access token is obtained.
This error is coming frequently for last 3-4 days.
Fatal error:
Uncaught exception 'apiAuthException' with message 'Error fetching OAuth2 access token, message:
'<HTML> <HEAD> <TITLE>Error processing OAuth 2 request</TITLE> </HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Error processing OAuth 2 request</H1>
<H2>Error 500</H2>
</BODY> </HTML>
'' in /google-api-php-client-0.5.0/google-api-php-client/src/auth/apiOAuth2.php:105
Stack trace: #0 /google-api-php-client-0.5.0/google-api-php-client/src/apiClient.php(138): apiOAuth2->authenticate(Array)
#1 l.php(191): apiClient->authenticate()
#2 l.php(99): googoauthinit(true)
#3 {main} thrown in /google-api-php-client-0.5.0/google-api-php-client/src/auth/apiOAuth2.php on line 105
The code I use is directly lifted from here (EXACTLY same code with all parameters like app name, secret key, id etc correctly filled).
Also, tried registering new app but same error is received.
It might be a Google synchronization issue. Check out this Google Groups post and see if you have a similar issue.
I believe this issue is similar to this question on SO. You'll find the solution in the comments of the answer.
To disable at run time, you can use
$this->client->setClassConfig("Google_Http_Request", "disable_gzip",
true) as well.
This worked great for me.
Hi i am trying to use soap to get results from amazon, and i havent tried this before so i was trying some sample code. The problem is i get an error.
the code is this:
<?php
#Use the NuSOAP php library
//require_once('lib/nusoap.php');
$params->AWSAccessKeyId = AMAZON_API_KEY;
$params->Request->SearchIndex = 'Books';
$params->Request->Keywords = 'php5';
$amazon = new SoapClient('http://webservices.amazon.com/AWSECommerceService /AWSECommerceService.wsdl');
$result = $amazon->itemSearch($params);
echo $result;
?>
and this is the error i get when i run it. thanx for your time
Fatal error: Uncaught SoapFault exception: [aws:Client.MissingParameter] The request must contain the parameter Signature. in C:\wamp\www\amasearch.php:11 Stack trace: #0 [internal function]: SoapClient->__call('itemSearch', Array) #1 C:\wamp\www\amasearch.php(11): SoapClient->itemSearch(Object(stdClass)) #2 {main} thrown in C:\wamp\www\amasearch.php on line 11
Weird. The WSDL doesn't have a signature parameter for any type. BUT, I found this in Amazon dev forums. Recommend you to check it out (also, if you develop using amazon services, keep that resource at hand
https://forums.aws.amazon.com/ann.jspa?annID=483
Looks like security gates for services are now taller and bigger, mate
EDIT: This question link to some example in C#. Maybe it can help you out Amazon (AWS) - The request must contain the parameter Signature
And this is an example in AWS forums with PHP https://forums.aws.amazon.com/message.jspa?messageID=149715