Podio::authenticate_with_app($app_id, $app_token); is not working - api

My client has a site on 'ideacontainer.net/real_coffee/'. Now I guess he has accidentally deleted the app then recovered it. But from that time he is not able to access his site.
This is the code in his index file
require_once 'podio-php-master/PodioAPI.php';
$client_id = "some-client-id";
$client_secret = "3zLcr...";
$app_id = "17373109";
$app_token = "48148cfca3c...";
Podio::setup($client_id, $client_secret);
Podio::authenticate_with_app($app_id, $app_token);
When I am commenting it line by line it is working till "Podio::authenticate_with_app($app_id, $app_token);" line. So I think the problem is in this line.
Please let me know the solution.
Thanks
Shashank Kumar

You need to create new client (the one mentioned in your code as client_id), also you will have to re-generate app token and re-check app_id. If it still doesn't work, please provide full error message returned from Podio API.

Related

CSRF failure in custom mongoose pre-hook (Keystone.js)

using keystone LocalFile type to handle image uploads. similar to the Cloudinary autoCleanup option, I want to be able to delete the uploaded file itself, in addition to the corresponding mongo entry when deleting entries through the admin ui.
in this case, I want to delete an "Album", and it's corresponding album cover.
Album.schema.pre('remove', function(next){
var path = this._original.album_cover.path + "/" + this._original.album_cover.filename
fs.unlink(path, function () {
console.log('deleted');
})
I get "CSRF failure" when using the fs module. I thought all CSRF protection was handled internally with Keystone.
Anyone know of a better solution to this?
Took a 10 minute break and came back and it seems to be working now. I also found this, which seems to be the explanation.
"Moreover double check your session timeout. In my dev settings the session duration is set to 3 minutes. So, if I end up editing something for more than that time, Keystone will return a CSRF error on save because the new session (generate in the meantime) invalidates the old token."
https://github.com/keystonejs/keystone/issues/1330

Get Business Information using twitter api

I am trying to get the business information of a registered organization using its Website URL.
I searched in many ways. Now, I had downloaded the Twitter API PHP SDK from github.
From the below link
https://github.com/J7mbo/twitter-api-php
In my index.php page, I have changed my code to
$url = 'https://api.twitter.com/1.1/users/search.json';
$getfield = '?q=Twitter%20API';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
echo $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
But, it gives me an empty result in the browser.
Please help me in getting some result out of it.
Thanks in advance!
I still didn't find any answer for my question. Now, I had downloaded the Twitter API PHP SDK from github.
From the below link
https://github.com/J7mbo/twitter-api-php
In my index.php page, I have changed my code to
$url = 'https://api.twitter.com/1.1/users/search.json';
$getfield = '?q=Twitter%20API';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
echo $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
But, it gives me an empty result in the browser.
Please help me in getting some result out of it.
Thanks in advance!
The error message you are receiving tells you the answer:
The Twitter REST API v1 is no longer active. Please migrate to API v1.1.
https://dev.twitter.com/docs/api/1.1/overview
Use the current API not the old one.

RestSharp How to use AddDefaultUrlSegment?

Everytime I try to use AddDefaultUrlSegment it does not work.
var client = new RestClient("http://example.com/{test});
client.AddDefaultUrlSegment("test",123);
when I look into fiddler it does this %7Btest%7D it is not putting 123 in. If I do the same thing in the Request part it works.
Anyone know what I doing wrong?

speedy_c2dm: NoMethodError (undefined method `gsub' for nil:NilClass)

I set up speedy_c2dm to send "push" messages to android devices.
The gem was working fine, but now I get this NoMethodError message when I call
SpeedyC2DM::API.send_notification(options)
the options parameter is good, I have verified this.
From the ruby-doc I got the following code from the gem:
def get_auth_token(email, password)
data = "accountType=HOSTED_OR_GOOGLE&Email=#{email}&Passwd=#{password}&service=ac2dm"
headers = { "Content-type" => "application/x-www-form-urlencoded",
"Content-length" => "#{data.length}"}
uri = URI.parse(AUTH_URL)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
response, body = http.post(uri.path, data, headers)
return body.split("\n")[2].gsub("Auth=", "")
end
You can see that the last line uses gsub, so I believe the problem is in the authentication method.
I have changed the password of the account since I created this, I updated the file with the password, initializers/speedy_c2dm.rb:
C2DM_API_EMAIL = "myemail#gmail.com"
C2DM_API_PASSWORD = "mynewpassword"
SpeedyC2DM::API.set_account(C2DM_API_EMAIL, C2DM_API_PASSWORD)
Can this be causing the error? That I changed the password even though I updated this file?
(Google doesn't let me to go back to the old password, I have to create a new one different from the old ones if I change it again)
Its the only thing I can think of since I didn't modify the gem's code.
How can I fix it? C2DM is deprecated now, but its supposed to keep working for old users. I don't want to migrate to GCM if I don't need to, everything is set up to work with C2DM
Any other ideas to fix it are welcome.
The problem was fixed after I removed the "two step verification" for logging in to my email.
This change can be made in the account configuration of gmail.

AS3 Flash api not setting game category app score - acces token error

Hope it's not a very noobish question i'm asking :) -
I'm trying to set the score parameter for my app ( Game category app ) with the AS3 Flash API ( Which i see is a wrapper around JS Api ) but i keep getting the "(#15) This method must be called with an app access_token" error, i've also tried a test call with the Graph API Explorer and the result is the same.( with generated acces token of the app and copy/pasted acces token )
I've searched the permission tables and i've set both publish_actions and user_games_activity for the authentification process.
Getting works perfectly ( i can receive basic information without any problems also score information but it's just an empty array probably because it isn't set ) posting seems to be the culprit
I want to know if i'm doing something wrong ( something like there's an additional auth process necessary on my server side )
If you guys have any ideea please help this is becoming very frustrating
Thanks in advance :D
Finally found the solution.
Here is the correct AS3 code:
var data:Object = new Object();
data.score = 285;
data.access_token = APP_ACCESS_TOKEN;
var requestType:String = "POST";
Facebook.api( Facebook.getAuthResponse().uid + "/scores/" , handlePostScoreComplete, data, requestType);
You MUST get the app access token using PHP or some other client-side SDK, not the Javascript SDK because it needs the app secret.
So in PHP you must get the access token and then you can pass it to Flash:
<?php
$APPLICATION_ID = YOUR_APP_ID;
$APPLICATION_SECRET = YOUR_APP_SECRET;
$token_url = "https://graph.facebook.com/oauth/access_token?" .
"client_id=" . $APPLICATION_ID .
"&client_secret=" . $APPLICATION_SECRET .
"&grant_type=client_credentials";
$app_token = file_get_contents($token_url);
?>