Podio REST API attach file incorrect rights to update file - podio

My goal is to copy an existing file from one item 'A' in app 'B', to item 'X' in app 'Y'.
First PHP API function PodioFile::copy(file_id) is used to copy the existing file attached to item 'A' and to get the file_id of the copy. Then, after authenticating with app 'Y',
PodioFile::attach(obtained_file_id_from_copy, array("ref_type" => "item", "ref_id" => item_x_id)
is used to attach the copied file to the item 'X' in app 'Y'.
The problem: When trying to attach the file a PodioForbiddenError is given. The response is as follows (error_description is important):
{"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http:\/\/api.podio.com\/file\/749459918\/attach","query_string":"","method":"POST"},
"error_description":"The app with id 21217623 does not have the right update on file with id 749459918","error":"forbidden"}
I haven't found any helpful information regarding this matter, hopefully someone is able to help me!

You can't access other app's data/files using another app's authentication.
You need to authenticate as app B to fetch file/data and change the authentication to app Y to attach/put file or data.
Otherwise, try using authenticating as a user who has access to both the Apps so you don't have to change the authentication each time.
Ref: Podio authentication

Related

app inventor 2 using a private fusiontable

I am creating an app in ai2 that connects to one of my fusion tables as a high score datastore.
If I use traditional Oauth2 flow then each user would be presented with an oauth login for their fusiontable, which is not what I want.
I have set up a
Client ID for Android application
in the google developer console which gave me
Client ID xxxxxxxxx.apps.googleusercontent.com
Redirect URIs
urn:xxx:xxx:xxx
http://localhost
Package name appinventor.ai_xxxxxxxx.xxxxxxxx
Certificate fingerprint (SHA1) 12:34:56 etc
Deep linking Disabled
What I want is for my app to connect to my fusiontable using my credentials regardless of which device or which user. How do I do that?
Thanks
This document is a very simple and straight-forward guide to creating a fusion table for your app.
https://docs.google.com/document/d/1HifuZqz5xu0KPS-e4oUv-t-nQoUQ8VMNyh_y6OjZkc0/pub
Steps:
First, you have to create a project at console.developers.google.com.
Then go to the API manager in the menu. Search for and enable the fusion tables API.
Now create a service account key. You may have to look in the credentials menu for this setting. Choose "enable Google apps-wide delegation". A service account is a localized email address that your app can use when you share the fusion table with that account. It provides more security than the anyone with the link can edit setting.
Now go to New Credentials > Service account key. Select P12, and the file will automatically download. If the name of the file has spaces, remove them.
Next, create a google fusion table.
Now share the table with the service email you created. Set the permission to Can Edit. Uncheck the notify box and hit Share.
Now, go to App Inventor. You need:
Your Service Account Email address (also called service account ID)
Service Account key file (.p12)
Fusion Table ID code (don't worry about this yet)
First, upload the key file.
In the fusion tables component property menu, set the KeyFile property to the key file. Copy the email address you created earlier and paste it in the ServiceAccountEmail property. Check the Use Service Authentication box.
Last thing: In the fusion table, go to File > About This Table. Copy the table Id. When you do operations with the table, you will need this id. You can store it in a variable if you want.
This property means that you can share and use multiple different tables with the same service account. Just share the other table(s) you will use with the service account and use that table's id when you do operations with that table.

Reclaiming a lost Facebook app

I am a new member of a team at my company reviving a legacy product that had Facebook integration, and we wish to continue developing the Facebook side of things, but we can't seem to find the credentials for logging into the app, or even who has access to it.
The app we are trying to recover is "HaloMobile". One thing to note though is the app name on posts is no longer a link. Does this mean the app has been disabled somehow?
I'm obviously not asking for credentials. At this point I'm just trying to "find" the app and possibly determine who is currently assigned as the administrator role, or what my options are. If there is an email address associated with the app, perhaps we can send a transfer request to that email?
If you could get retrieve two piece of information from your code-base, which are App ID and App Secret then you can retrieve the list of roles assigned in app using the following end point,
https://graph.facebook.com/<App_ID>/roles?access_token=<App_ID>|<App_Secret>
And once you know the role, along with the user Ids of the user assigned to it, you can move forward to recover the App by contacting him.
Also, you might want to give this documentation about Application a look, which lists out various fields you can retrieve for getting the required information to get access to your application back, like user_support_email
https://graph.facebook.com/<App_ID>?
fields=name,description,creator_uid,user_support_email
&access_token=<App_ID>|<App_Secret>

Windows 8 Store: Denied DocumentsLibrary Access during certification

I am building a suite of apps that rely on each other's data.
I wanted to put this shared data repository in the Documents library folder.
However, when I attempt to submit the app to the Windows 8 store, I am denied access to that folder location.
I have a developer account which does not qualify for DocumentLibrary access.
I was told that because I am not a company, I do not qualify for a company account.
How can I share application data with my other apps when offline?
Yes, one of the differences between company/individual accounts is access to the Document Library (full list of differences here).
If offline is a requirement, one option is SQLLite. See Tim's post on it here.
If online is sufficient, Windows Azure Mobile Services is pretty awesome for throwing up a quick and easy database backend. More details here.
Windows Store apps run in a sandboxed environment, isolated from each other, therefore they can't easily share their data.
If having a custom online service that both apps can connect to for sharing data between them is not enough, then you'll need the user to select a folder (from both apps) where the shared data will be stored. This way you'll be able to access it.
First use FolderPicker for the user to select the folder:
var picker = new FolderPicker();
picker.FileTypeFilter.Add(".sqldb");
var folder = await picker.PickSingleFolderAsync();
Then add the folder to FutureAccessList so that you'll keep the access to it even after the app gets restarted:
var token = StorageApplicationPermissions.FutureAccessList.Add(folder);
You need to store the token so that you can load it next time. LocalSettings would be a suitable location. When your app is run again, you first read the token and with it regain access to the selected folder:
var folder = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync(token);
I know this is not a perfect solution since it needs user intervention to setup everything correctly, but I think it's the only way to make such data sharing between apps possible. Even so, you might have a hard time certifying the app with this functionality.

Rally: Seeing information about the current user from a web client

I'm writing a Rally app using REST service calls and JQuery. I'd like to customize app behavior to the current user, i.e., show their default project. Is there a way to get a username or ID for the current auth session? The closest I've found is this website url, which redirects to the userid (if you request it while logged in).
https://rally1.rallydev.com/#
But is there a real way to do it? A REST call would be nice, but I guess that's not RESTful?
You can make a request to https://rally1.rallydev.com/slm/webservice/1.38/user.js and it will return results for the currently logged in user.
Include UserProfile and DefaultProject in your fetch and any other fields on Project, Workspace, WorkspaceConfiguration and UserProfile objects and you should be able to get most of the info you're looking for.
If you're using SDK 2 some of this information is already available in the current context:
Rally.environment.getContext().getUser();

Replace "via Graph API Explorer" label by my application name

I am quite new in Facebook application development. I was playing the all day with "how to post a message on the wall of a page?". I finally succeeded but each message got "via Graph API Explorer". I tried to find how to change it to my application name without success. I tried to see if I could force the value of application in the api command but it did not take it into account. Maybe I miss something :( If someone can help, that would be great!
I am still quite confused. Let me try to explain what I want to do: I would like to automatically publish on a page (as the page) some event that are defined on a website (in a kind of agenda). What I miss, I think, is how everything is working together on Facebook side:
1. the login process: as the application will run in a cron, this should not display a login dialog box.
2. the access token: application or page one?
3. the permissions: from my understanding, I need manage_pages (and publish_stream) but not clear how this should be set.
Thx for any clarification and maybe a clear example :o)
You need the user to authorise your own App using one of the Login flows and grant you one of the publishing Permissions -
If it says 'via Graph API Explorer' on the posts your app makes you're using the access token you retrieved when you were testing the API using the Graph API Explorer tool, not one produced by your own app
OK I think I have finally found the way to do it. I needed a page access code and not an application access code. The token must be generated outside the application as a long live one.
Get a code using:
https://www.facebook.com/dialog/oauth?client_id={app_id}&redirect_uri={my_url}&scope=manage_pages,publish_stream
app_id is your application ID
my_url is your application URL
scope is the permission you want to be granted
In the redirected URL, you will have a code parameter. Copy it.
Generate the user access code using:
https://graph.facebook.com/oauth/access_token?client_id={app_id}&redirect_uri={my_url}&client_secret={app_secret}&code={code}
app_secret is your application secret key
code is the code from step 1
You will get as output the user access token. This one is a short live one.
convert the short live to a long live user access token using:
https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id={app_id}&client_secret={app_secret}&fb_exchange_token={short live access token}
Replace the "short live access token" by the one you got on step 2
You will get as output the infinite user access token.
Get the page access token (this one will be infinite access token as
the user access token is now an infinite access token too):
https://graph.facebook.com/me/accounts?access_token={infinite user access token}
Replace the "infinite user access token" with the value you got on step 3.
This command will list all the pages you administer. The output contains the page access token you need in field "access_token". You can so use this token in any API command in your application.
The best of the best is to do all those steps via a server side program (PHP for me) as the application secret key should remain "secret".