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.
Related
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.
I have created basic webtool for candidate information using PHP Sharepoint API (Thybag).
I could do create the listitem. But I try to attach a file, i received this error.
Fatal error: Uncaught exception 'Exception' with message 'Error
(soap:Server) Exception of type
'Microsoft.SharePoint.SoapServer.SoapServerException' was
thrown.,more=Detailed: The security validation for this page is
invalid. Click Back in your Web browser, refresh the page, and try
your operation again.' in D:\wamp\www\jobs\SharePointAPI.php on line
1013.
I couldn't see any error report in github regards this.
This is code i try to execute: $sp->addAttachment('applicant', 21, "files/PID.txt");
all authentication process are done in while execute the PHP file.
Anybody can help this to resolve?
I was also facing similar issue. The issue lies in this file
PHPSharePointListsAPI/src/Thybag/Auth/SharePointOnlineAuth.php on line 22
Just replace line 22 with the below code :-
$headers = array('SOAPAction: "' . $action . '"');
Hope that helps.
Thanks.
we had a working facebook app with an own action that has been reviewed and been approved by facebook. Everything worked fine.
After changing the namespace and the title of the app, we now get an an error when sending the action via php sdk, althought all the action is still marked as approved and live.
$response = $facebook->api(
'me/myapp:create',
'POST', array('custom_object' => "http://www.myapp.com/metatags.php") );
This is the error we receive:
OAuthException: An unexpected error has occurred. Please retry your request later.
We've' already checked if the access token is vaild, it is!
Is it possible that facebook needs to re-approve custom actions after changing the namespace? Or does it need some time until it works again?
I dealt with this today, however my experience was in JavaScript, so I don't have relevant code to provide, you should be able to apply the same theory!
It seems that the error only happens once per access request - if you try to post again immediately after, it will usually be accepted by facebook with no error. Since the error code returned for unknown error is always the same, you can simply catch the error code from the response object and run the function again if it matches.
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 have made new Facebook application, and when I am trying to allow "post to profile", I am getting this error:
Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in /home/mimota/public_html/gamingapp.com/test/src/base_facebook.php on line 1024
Thats part of the base_facebook.php file:
http://codeviewer.org/view/code:2263
I have marked there where is line 1024
I will really appriciate if some one could figure out whats wrong here, because I have no clue..
Thanks.
Use a URL of the following format to log into facebook:
https://graph.facebook.com/oauth/authorize?client_id=288229791195831&redirect_uri=http://www.facebook.com/connect/login_success.html&type=user_agent&display=popup&scope=publish_stream,user_photos,read_stream,email
They will give you a token back which you will use when you send requests:
For example to see get the main photo URL use:
https://graph.facebook.com/me/picture&access_token=THE_TOKEN_YOU_GOT_BACK
To post to wall replace /me/picture with whatever you need to post (sth like /me/wall)