Message: Invalid argument supplied for foreach() for Flickr - foreach

I recently switched our site to a different server for ExpressionEngine and all of a sudden I'm getting errors when trying to access a drop down list of Flickr albums.
This is what the error says:
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: flickr_sets/ft.flickr_sets.php
Line Number: 35
Here is the code for the php file...line 35-37
foreach($sets['photoset'] as $photoset) {
$photo_sets[$photoset['id']] = $photoset['title'];
}
I haven't changed anything but am wondering if I need to reauthorize the token since I switched to a different server.
Anyone has any idea?

Related

ExactOnline: Token is not allowed, because of invalid or empty chainId

We have a java application that connects to ExactOnline for performing the operations.
The connection works fine for almost 9days and then it will start complaining about the below exception:
"Request from start.exactonline.nl returned an error (response code: 400, response: { "error":"invalid_grant","error_description":"Token is not allowed, because of invalid or empty chainId"
After encountering this error we have to force re-authorize the application by the user to get the new accessToken.
Now I am getting the below error as well:
"Request to token endpoint https://start.exactonline.nl/api/oauth2/token"
Any help would be appreciated.
The error message it's background and the solutions are explained at https://forums.invantive.com/t/exact-online-error-token-is-not-allowed-because-of-invalid-or-empty-chainid-on-exact-online/2226

com.microsoft.graph.http.GraphServiceException: Error code: SyncStateInvalid

com.microsoft.graph.http.GraphServiceException: Error code: SyncStateInvalid
Error message: The sync state identified using the request token 'HzWyBB6EZsMOpd9NmgmVnqAnVEMAAAQ9rM8FAwAA' is no longer valid.
GET https://graph.microsoft.com/v1.0/users/6be2c2df-8e20-4f99/mailFolders/AQMkADlmY2YxNTY3LWVhNjItNDFhMS1iZDA0LWZ/messages/microsoft.graph.delta?$deltatoken=LztZwWjo5IivWBhyxw5rAHNeTrUj6tmJCwsicW9zTkZhNFWO0u7VKvvdkBxQHWUvDsSPLMpUBSlb3nEcc_qVbTk1hQlWa3MIyqHvnT47wRA.NIA-bd_JnbZrpOuTHnjHoWWo1K5QPy4CLrFTODjYn9c
Prefer : odata.maxpagesize=1
Prefer : IdType="ImmutableId"
SdkVersion : graph-java/v1.6.0
Authorization : Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI[...]
Hi guys, I'm getting the above SyncStateInvalid error, I've done a search, realizing that most people are facing SyncStateNotFound error instead.
Not sure if anyone faces this issue before and knows what is the fix.
I am trying to sync incremental mail messages based on the delta token.
I've tried to paste the same link in graph explorer, and was able to get result.

Yelp Place API returning "Invalid Signature" Error only from Nginx on EC2

Problem: I am getting an "Invalid Signature" error from Yelp API only from production (running on nginx server in AWS) When I run locally on my localhost:3000, there is no signature error, and everything works fine.
I am using the yelp gem in rails. Here's some code in ruby.:
$client = Yelp::Client.new({
consumer_key: $SL_CONSUMER_KEY,
consumer_secret: $SL_CONSUMER_SECRET,
token: $SL_TOKEN,
token_secret: $SL_TOKEN_SECRET
})
begin
$client.search("Los Angeles")
rescue => error
puts error.message
puts error.inspect
end
error.message prints out: "Signature was invalid"
error.inspect prints out: < Yelp::Error::InvalidSignature: Signature was invalid >
Everything works when I run locally on rails' Webrick server but when I run it in production, I get an "Invalid Signature" error.
Has anyone seen this? I've looked at some relevant posts, but this seems different. Thanks!
This will probably not pertain to most people, but the off chance it could help someone, here it is:
My "time" was effed up on my EC2 instance. So for example, in ruby, Time.now was not printing the actual time. (I think it was off by a few minutes or so).
Anyway, Yelp API requires a oauth_timestamp when you send a request. Of course, then, my request was timing out b/c the time was off.
How did I found this error out?
I just pinged the URL on my browser with the oauth, token, oauth_timestamp, etc. (few more) as query params. The browser spits out the error response in JSON, and it was saying that my request was timing out. When you use the ruby Yelp Client and catch the exception in code, it doesn't spit out the error response in terminal, so it's a bit more difficult to locate the exact root of the error.
How I solved it:
I re-calibrated the time in my ec2 instance by following the directions here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html
Problem is solved. Peace.
Invalid signature error in Yelp API occurs due to two reasons .
First , Either of your four keys i.e consumer_key , consumer_secret_key , Token & Token Secret is invalid . Secondly Parameters passed to Yelp API Function are either invalid or any of those are nil .

Newbie OAuth issue: Error when trying to use the PHPoAuthLib OAuth lib

I've got an issue using this OAuth lib when connecting with twitter:
https://github.com/Lusitanian/PHPoAuthLib
I'm using the following url to connect:
http://www.myserver.com/oauth/examples/twitter.php?go=go
I'm getting the following error:
Fatal error: Uncaught exception 'OAuth\Common\Http\Exception\TokenResponseException' with message 'file_get_contents(https://api.twitter.com/oauth/request_token): failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized ' in /webDeploy/V2/sites/wandexBB/oauth/src/OAuth/Common/Http/Client/StreamClient.php:75 Stack trace: #0 /webDeploy/V2/sites/wandexBB/oauth/src/OAuth/OAuth1/Service/AbstractService.php(52): OAuth\Common\Http\Client\StreamClient->retrieveResponse(Object(OAuth\Common\Http\Uri\Uri), Array, Array) #1 /webDeploy/V2/sites/wandexBB/oauth/examples/twitter.php(59): OAuth\OAuth1\Service\AbstractService->requestRequestToken() #2 {main} thrown in /webDeploy/V2/sites/wandexBB/oauth/src/OAuth/Common/Http/Client/StreamClient.php on line 75
It looks like the request body is empty.
I see in the code the following params are being used:
$_GET['oauth_token'],
$_GET['oauth_verifier'],
What are these params? I see in my twitter account I have various tokens available after I created my app on twitter, is it something to do with that?
I'm lost :/ This could be the wrong approach altogether.
Can anyone help with this?
Thanks in advance.
This lib seems to have a bug relating to the twitter implementation. Now using a different lib and got that going much more easily:
https://github.com/sudocode/ohmy-auth

Java NullPointerException null when calling forge.ajax

When calling forge.ajax and request returns a 401 with JSON, under Android only (both device and emulator) I'm getting the following error message:
[ INFO] D/Forge (25373): Returning: {"content":{"type":"UNEXPECTED_FAILURE","message":"Forge Java error: NullPointerException: null","full_error":"java.lang.NullPointerException\n\tat io.trigger.forge.android.modules.request.API$1$1.getPasswordAuthentication(API.java:107)\n\tat java.net.Authenticator.requestPasswordAuthentication(Authenticator.java:140)\n\tat libcore.net.http.HttpURLConnectionImpl.getAuthorizationCredentials(HttpURLConnectionImpl.java:432)\n\tat libcore.net.http.HttpURLConnectionImpl.processAuthHeader(HttpURLConnectionImpl.java:407)\n\tat libcore.net.http.HttpURLConnectionImpl.processResponseHeaders(HttpURLConnectionImpl.java:356)\n\tat libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:292)\n\tat libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168)\n\tat io.trigger.forge.android.modules.request.API$1.run(API.java:285)\n\tat io.trigger.forge.android.core.ForgeTask$1.doInBackground(ForgeTask.java:112)\n\tat android.os.AsyncTask$2.call(AsyncTask.java:287)\n\tat java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:137)\n\tat android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)\n\tat java.lang.Thread.run(Thread.java:856)\n"},"status":"error","callid":"46C2A570-7229-4427-9BF8-F64FB12F6D8F"}
The forge.ajax error callback is being fired but the error.content object contains the string above and does not have the response.
Notice that this is not happening on iOS.
You can see this in action when running the app from the play store and trying to login with a wrong password/non existing user.
Full source code is available on github
This arose when attempting to access HTTP resources protected with basic auth, and no username was supplied to request.ajax.
The bug was fixed in v1.4.24 of the platform - sorry for the inconvenience!
http://docs.trigger.io/en/v1.4/release-notes.html#v1-4-24

Resources