Talk:Fb:prompt-permission
From Facebook Developer Wiki
[edit] Question: next_fbjs is called regardless of choice?
The article states that next_fbjs is called "if the user grants the requested permission" but is called if the user clicks 'don't allow'... Am I doing something wrong, or is something not working as intended?
-- definately Looks like a bug to me!!
- Please file a bug so we can investigate. Thanks, Pete -- 563683308 11:55, 27 October 2009 (PDT)
[edit] Question: Normal users and infinite session
That example looks like it might be for the iframe'ers? Is all that really necessary for a normal app too? Maybe it is and that's why I couldn't get it to work in my quick test :-( --543396022 13:05, 14 July 2008 (PDT)
- Actually, I grabbed the source for the form from the Smiley sample app: http://apps.dev.facebook.com/mysmiley/.
- It appears that all that is necessary for normal users is something like this:
- <fb:prompt-permission perms="infinite_session">infinite_session<br /></fb:prompt-permission> <fb:prompt-permission perms="email">email<br /></fb:prompt-permission> <fb:prompt-permission perms="status_update">status_update<br /></fb:prompt-permission> <fb:prompt-permission perms="photo_upload">photo_upload<br /></fb:prompt-permission> <fb:prompt-permission perms="create_listing">create_listing<br /></fb:prompt-permission>
- But I cannot get infinite_session working. Anybody else having this issue? 26716424 09:28, 25 July 2008 (PDT)
Use offline_access to get infinite session.
[edit] Question: How do I make the link that fb:prompt-permission generates PRETTY?
I set <fb:prompt_permission class="inputsubmit" perms="offline_access">Generate Permanent Login</fb:prompt_permission>, but it appears to have stripped out my class attribute!!! --186000005 12:23, 12 August 2008 (PDT)
- The best is probably to put an image in this link, as the text will remain ugly...
[edit] Question: How do I make the link that fb:prompt-permission generates REDIRECT somewhere after the user grants the permission?
I set <fb:prompt_permission perms="offline_access" next_fbjs="window.location = window.location" >Generate Permanent Login</fb:prompt_permission>, but the convert my window.location to a18600904100_window.location, rendering it ineffectual. --186000005 12:23, 12 August 2008 (PDT)
- sample code in php:
- <script type="text/javascript">
- function permissionGranted() {
- document.setLocation('http://apps.facebook.com<%=$_SERVER['REQUEST_URI']%>');
- }
- </script>
- <fb:prompt-permission next_fbjs="permissionGranted()" perms="offline_access">enable offline access</fb:prompt-permission>
- <fb:prompt-permission next_fbjs="permissionGranted()" perms="email">allow email responses</fb:prompt-permission>
This worked for me: --1760392039 06:43, 16 September 2009 (PDT)
- <script type="text/javascript">
- function permission_gohome()
- {
- document.setLocation('http://apps.facebook.com/myapp/');
- }
- </script>
- <fb:prompt-permission perms="publish_stream" next_fbjs="permission_gohome()">Publish stories automatically</fb:prompt-permission>
[edit] Question: Is there any other way to grant an application offline access?
I haven't found a way in the application settings anywhere. I think this is a pretty big limitation as some users would like to give access before the application has made the transition.
- Yes. You can use the
promptpermissionattribute in a form. See UsageNotes/Forms#Prompting_a_User_for_an_Extended_Permission for details. -- Pete User:563683308
- Yes. You can use the
[edit] Question: Incorrect post-grant redirect
I'm successfully using this FBML to show the dialog box for enabling email permissions to the user, but the text of the dialog box has my application name in there with an incorrect link -- it is linking to the "Callback URL" instead of either the "Canvas URL" or "About Page" URL. Is this a bug, or something I can fix through configuration? --544836835 17:02, 22 September 2008 (PDT)
- This is likely a bug. An engineer is looking into it currently. Thanks for reporting. -- Pete (User:563683308)
I read on the forum the possibility of adding a callback to the function. This, however, does not use the <fb:prompt-permission> tag. I also tried the 'next_fbjs' method but all it does it stop loading the page after a successful click. My text (that should disappear) stays on the page.
Is there a fix for this problem? Or is there a callback solution that is working?
See http://forum.developers.facebook.com/viewtopic.php?pid=117374 for the forum discussion.
[edit] Question: Is there any way to grant extended permissions from the mobile facebook site?
None of the three methods (FBML, form based, or even directing to the authorize.php page) work. There is currently no way to enable any extended permissions from a mobile phone. Is this going to be fixed?
- It's a feature that's being worked on at the moment. I can't offer you a completion date at this time, sorry. -- Pete (563683308 14:28, 7 January 2009 (PST))
[edit] Question: It looks as if the prompt-permission tag doesn't work inside dialog boxes inside IE, however works in FF. Sounds like a bug?
- Thanks for noting this Mike. We're not aware of this being an issue. Please file a bug and note with which versions of IE it doesn't work. Thanks! -- Pete (563683308 12:01, 9 February 2009 (PST))
- Bug has been filed, http://bugs.developers.facebook.com/show_bug.cgi?id=4357
[edit] Question: Is there any update on the mobile facebook prompt-permission capability please?
[edit] Question: Progress on setting extended permission with m.facebook.com?
Pete, what is the progress on setting the extended permission with m.facebook.com? Or, even just get it to work with other two ways (FBML or Form) with PocketIE? Please let us know. Thanks!!
Koko at kokolin@yahoo.com
[edit] Question: Is there any way to handle the event in case user clicks on Cancel?
There is a parameter next_fbjs which will be called if the user opts for any extended permission. If the user clicks on cancel, is there a way to capture and handle this event?
[edit] Question: Is there a way to initiate the same "Settings" link/dialog that FB Applications page uses, giving the user a quick way to remove permissions from within the application?
[edit] Question: how to auto display prompt-permission automatically?
Is there a way to automatically prompt a user for permission(s) when the app loads?
You could call load the JS API properly, then make a call to FB.Connect.showPermissionDialog(). At least that's the theory. I've never got the stupid thing to work. It always pops up a dialog box for me that quickly flashes away before I get the chance to interact with it.
Alternatively, you could use jQuery to select the necessary hyperlink and make it click after giving it enough time to load:
- FB.init("API_KEY", "PATH/TO/xd_receiver.htm");
- setTimeout("jQuery(\".FB_prompt_permission a\").click()", 2000);
If you don't mind requiring that the user initiate the action, then the <fb:prompt-permission> tag works well.
Also helpful: http://developers.facebook.com/docs/?u=facebook.jslib.FB.Connect.showPermissionDialog
The reason it flashes away quickly is because you have already set the permissions. If you want to view it again then while in your application, hover over 'settings' and select your application, go to further options and uncheck the boxes.
So is there a way to automatically show this permission box if the user hasnt already set the permissions?
[edit] Question: How can I call prompt-permission from AS3?
I want to call the prompt-permission from my AS3, but cant find how to do that. Can anyone help?
- Adobe supports the AS3 library, and you can find their docs at http://facebook-actionscript-api.googlecode.com/svn/release/current/docs/index.html. Specifically, there's a method in the Facebook class called grantExtendedPermission() -- passing a comma-separated list of extended permissions to that call should do the trick. Pete (563683308 14:20, 28 July 2009 (PDT))
[edit] How can u capture the permission after promting to user
I have to capture whether the user clicks on Allow or Don't allow in my alert_me() function. Is there any way? <fb:prompt-permission perms="offline_access" next_fbjs='alert_me()' >offline_access permission</fb:prompt-permission>
[edit] Question: Is there an easy way to conditionally display the <fb:prompt-permission> tag?
I am looking for something like this: <fb:if-user-has-perms uid="123456" perms="email"><fb:prompt-permission perms="email">Grant email permission</fb:prompt-permission></fb:if-user-has-perm> Is it possible?
- You can check whether the user has the perm by calling users.hasAppPermission, then display the permission tag as needed. Pete (563683308 20:05, 20 September 2009 (PDT))
