Closed (works as designed)
Project:
Facebook OAuth (FBOAuth)
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 Feb 2012 at 20:09 UTC
Updated:
6 Aug 2014 at 13:43 UTC
Jump to comment: Most recent
Comments
Comment #1
quicksketchThe FBOAuth module does not currently store the $access_token anywhere that is accessible outside of requesting the user to execute an action. In order to attempt to execute an action without the user's explicit request of that action, you would need to record the $access_token returned from Facebook somewhere (like in the $_SESSION variable) during a previous action's processing.
For the purposes of this module, what you're asking to do is not really supported. If you're wanting to do something like import a user's friends upon login, you'd need to make a different action for something like "login_and_import_friends", which would log the user in (just by calling the existing login callback) but then store the access token elsewhere to start doing the import after login.
Comment #2
giorgio79 commentedMuch appreciated quicksketch, then I will write actions as this module seems very stable.
Comment #3
giorgio79 commentedJust tired to write a simple action, but these seem to be hardcoded for display.
For example, here is an action I just tried putting together for getting friends:
I don't see how I could just get the list of ids to my function, as this is only returning a path. Any tips? :)
Comment #4
quicksketchThe intention is that you would call your function from within your callback (or just put the necessary code directly in the callback). If you're planning on doing this "in the background", you could also make an entry in a database table and do the request on a frequently running cron job (along with the $access_token that you would need.
Comment #5
giorgio79 commentedThanks quicksketch.
Currently I use the Drupal menu system for my custom links, so I can hook into Drupal access control and custom page callback.
Here is the flow:
1. User clicks on a custom link
2. With Drupal hook menu I check if user has access, in this check I verify that access token is valid etc.
3. With Drupal hook menu I specify a custom page_callback to perform custom code
4. Use FB oauth in page callback to get list of friends
5. Redirect the user to a node given the result
It seems like I would need to rewrite the entire logic around fboauth action links if I wish to access the graph api but I prefer to stick with Drupal menu system for now and just write some custom code.
Thanks for your help anyway.
Comment #6
quicksketchSounds similar to what was requested a few days ago, see: #1420710: Initiating an action when user browses to a page
Comment #7
giorgio79 commentedMuch appreciated quicksketch, I will keep on playing with it and adjusting my frame of mind. :)
Comment #7.0
giorgio79 commentedclarify
Comment #8
skh commentedSorry wrong advice.