/projecte eclipse/TI/data/2012-documentos/60/2012-60-144.html
HTML | 215 lines | 144 code | 57 blank | 14 comment | 0 complexity | 192a4f4c423bb9477614da3919647b84 MD5 | raw file
-
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr">
- <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta id="metaLanguage" http-equiv="Content-Language" content="en" /><title>
- PHP - How to handle facebook authorization when user clicks "dont allow" - efreedom
- </title><link rel="shortcut icon" href="http://efreedom.com/favicon.ico" />
- <script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
- <script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>
- <script language="javascript" type="text/javascript" src="http://efreedom.com/Javascript/efreedom.js"></script>
- <script language="javascript" type="text/javascript">window.google_analytics_uacct = "UA-4332911-7";</script>
- <link rel="Stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" /><!--[if lte IE 7]> <link rel="Stylesheet" type="text/css" href="http://efreedom.com/css/efreedom-IE.css" /> <![endif]--><link rel="Stylesheet" type="text/css" href="http://efreedom.com/css/efreedom.css" />
- <link rel="Stylesheet" type="text/css" href="http://efreedom.com/css/Prettify/Prettify.css" />
- <script language="javascript" type="text/javascript" src="http://efreedom.com/Javascript/Prettify/Prettify.js"></script>
- </head>
- <body>
- <div id="header">
-
-
- <div id="headerContent">
- <div id="logo">
- <a href="/" title="International Technology Answers">
- <img src="http://efreedom.com/Images/logo1.png" alt="International Technology Answers" />
- </a>
- <div id="logoTitle">International Technology Answers</div>
- </div>
- <div id="headerRight">
- <div id="search">
-
- <script type="text/javascript" src="http://www.google.com/jsapi"></script>
- <form action="/search" id="cse-search-box">
- <div id="cse-div">
- <input type="hidden" name="cx" value="partner-pub-5095240990837916:btxr0w-yrgf" />
- <input type="hidden" name="cof" value="FORID:10" />
- <input type="hidden" name="ie" value="UTF-8" />
- <input type="text" name="q" id="q" autocomplete="off" size="35" value="" maxlength="255" />
- <input type="submit" name="sa" value="Search" />
- </div>
- </form>
- <script type="text/javascript">google.load('search', '1');</script>
- <script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script></div>
- <div id="nav"><a href="/About">Readme</a> | <a href='/Privacy'>Privacy Policy</a> | <a title='Give us your feedback, good or bad!' href="mailto:efreedomtech@gmail.com?subject=[Insert%20Title%20Here]&body=[Insert%20Feedback%20Here]">Contact Us</a></div>
- </div>
- </div>
-
- </div>
- <div id="content">
- <div id="mainContent">
-
- <div id="questionTemplate">
-
- <!-- google_ad_section_start -->
- <h2 id="questionTitle">PHP - How to handle facebook authorization when user clicks "dont allow"</h2>
- <!-- google_ad_section_end -->
-
- <div id="questionArea" style="position: relative;">
-
-
- <!-- google_ad_section_start(weight=ignore) -->
- <div id="languages" style="position: absolute; left: -120px; top: 15px; width: 100px; text-align: center;"><div id='languagesCaption'>Translations</div><a href='http://efreedom.com/Question/1-6387847'>English</a><br/><a href='http://ar.efreedom.com/Question/1-6387847'>العربية</a><br/><a href='http://bg.efreedom.com/Question/1-6387847'>български</a><br/><a href='http://ca.efreedom.com/Question/1-6387847'>català</a><br/><a href='http://zh.efreedom.com/Question/1-6387847'>中文</a><br/><ahref='http://cs.efreedom.com/Question/1-6387847'>čeština</a><br/><a href='http://da.efreedom.com/Question/1-6387847'>dansk</a><br/><a href='http://nl.efreedom.com/Question/1-6387847'>Nederlands</a><br/><a href='http://et.efreedom.com/Question/1-6387847'>eesti</a><br/><a href='http://fi.efreedom.com/Question/1-6387847'>suomi</a><br/><a href='http://fr.efreedom.com/Question/1-6387847'>français</a><br/><a href='http://de.efreedom.com/Question/1-6387847'>Deutsch</a><br/><a href='http://el.efreedom.com/Question/1-6387847'>Ελληνικά</a><br/><a href='http://he.efreedom.com/Question/1-6387847'>עברית</a><br/><a href='http://hi.efreedom.com/Question/1-6387847'>हिंदी</a><br/><a href='http://hu.efreedom.com/Question/1-6387847'>magyar</a><br/><a href='http://id.efreedom.com/Question/1-6387847'>Bahasa Indonesia</a><br/><a href='http://it.efreedom.com/Question/1-6387847'>italiano</a><br/><a href='http://ja.efreedom.com/Question/1-6387847'>日本語</a><br/><a href='http://ko.efreedom.com/Question/1-6387847'>한국어</a><br/><a href='http://lv.efreedom.com/Question/1-6387847'>latviešu</a><br/><a href='http://lt.efreedom.com/Question/1-6387847'>lietuvių</a><br/><a href='http://no.efreedom.com/Question/1-6387847'>norsk</a><br/><a href='http://pl.efreedom.com/Question/1-6387847'>polski</a><br/><a href='http://pt.efreedom.com/Question/1-6387847'>Português</a><br/><a href='http://ro.efreedom.com/Question/1-6387847'>română</a><br/><a href='http://ru.efreedom.com/Question/1-6387847'>русский</a><br/><a href='http://sk.efreedom.com/Question/1-6387847'>slovenčina</a><br/><a href='http://sl.efreedom.com/Question/1-6387847'>slovenski</a><br/><a href='http://es.efreedom.com/Question/1-6387847'>español</a><br/><a href='http://sv.efreedom.com/Question/1-6387847'>svenska</a><br/><a href='http://th.efreedom.com/Question/1-6387847'>ไทย</a><br/><a href='http://tr.efreedom.com/Question/1-6387847'>Türkçe</a><br/><a href='http://uk.efreedom.com/Question/1-6387847'>українська</a><br/><a href='http://vi.efreedom.com/Question/1-6387847'>Tiếng Việt</a><br/></div>
- <!-- google_ad_section_end -->
-
-
- <div id="fullQuestion">
- <!-- google_ad_section_start -->
- <div id="fullQuestionBody"><p>I'm working on developing a facebook tab application that works out of an iFrame. I have everything working perfectly on the authorization side except for handling cases where the user clicks "Don't Allow". But here I'm stuck. After spending several hours last night trying to work out the kinks I have no idea where to go from here.</p>
- <p>The flow my application is taking is this. First the user is prompted to "Like" the page to access more of the application. At this point if they click like the next step is revealed but first a check is made to see if the app has authorization. If not some JS is place in the onload event that redirects the parent frame to the authorization link with the return_uri set to the link for the page's app tab. This works perfect if the user clicks Allow. If they click Don't Allow then it ends up going in a loop as things stand, repeatedly going back to the authorization page. What I would like it to do is display a little explanation page with a link back to the authorization page if the user wishes to reconsider their choice.</p>
- <p>I found that the problem preventing me from handling this ok is that the application is in an iframe on the page the return_uri links back to (the app tab on the page). So the error and error_reason GET vars aren't available to my code, only the parent frame which is facebook and not under my control.</p>
- <p>What can I do to get this functionality added to my application? Thanks!</p>
- </div>
- <!-- google_ad_section_end -->
- </div>
-
-
-
-
- <div id="questionCredit">This question and answers originated from <a id="hypQuestionCredit" rel="" href="http://www.stackoverflow.com/questions/6387847" target="_blank">www.stackoverflow.com</a></div>
- <div id="questionUserCredit">Question by <a id="hypQuestionAuthor" rel="author" href="http://www.stackoverflow.com/users/656049/Kenneth" target="_blank">Kenneth</a> (6/17/2011 3:08:56 PM)</div>
-
- </div>
-
- <div style="padding:10px 0px 0px 0px; position:relative;width:100%;">
- <div id="answerHeader">
- <table>
- <tr>
- <td><div id="answerCaption" style="top: -6px;"><h4>Answer</h4></div></td>
- <td><div style="position: relative; left: 25px; top: 4px;"><script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script><g:plusone></g:plusone></div></td>
- <td><span class="st_twitter_large" displayText="Tweet"></span><span class="st_facebook_large" displayText="Facebook"></span><span class="st_ybuzz_large" displayText="Yahoo! Buzz"></span><span class="st_gbuzz_large" displayText="Google Buzz"></span><span class="st_email_large" displayText="Email"></span><span class="st_sharethis_large" displayText="ShareThis"></span></td>
- <td><div id="fblike" style="padding-left:35px;"></div></td>
- </tr>
- </table>
- </div>
- </div>
-
- <div id="fullAnswer" style="position: relative;">
-
- <!-- google_ad_section_start -->
- <div id="fullAnswerBody"><p>I had this exact same problem with a page tab. I am using the OAuth dialog to handle the login but like you say, you redirect to the page url with the app in it and you can't get the error.</p>
- <p>What I did was set a session variable that I was attempting to authorize before redirecting to the auth dialog. That way if I end up not getting an authorized user I can see they tried already and show an appropriate message. Something like this:</p>
- <pre class="prettyprint"><code>$facebook = new Facebook(array(
- 'appId'=>'my_app_id',
- 'secret'=>'my_secret')
- );
- $fb_user = $facebook->getUser();
- if( $fb_user ) {
- $_SESSION['auth_check'] = 0;
- // rest of application is authorized
- }
- elseif( isset($_SESSION['auth_check']) && $_SESSION['auth_check'] ) {
- // we attempted to authorize before and something went wrong
- // show a message explaining they need to authorize
- $_SESSION['auth_check'] = 0; // set so they get the auth screen again
- }
- else {
- $_SESSION['auth_check'] = 1; // attempting to authorize
- header("Location: $fb_oauth_dialog");
- }
- </code></pre>
- <p>Hope that helps!</p>
- </div>
- <!-- google_ad_section_end -->
-
- <!-- google_ad_section_start(weight=ignore) -->
-
-
-
-
- <div id="answerUserCredit">Answer by <a id="hypAnswerAuthor" rel="author" href="http://www.stackoverflow.com/users/119326/Cfreak" target="_blank">Cfreak</a></div>
-
- <script type="text/javascript" language="javascript">$(document).ready(function () { $.getScript("http://w.sharethis.com/button/buttons.js", function () { stLight.options({ publisher: '71ff5d2a-00fd-498e-bf01-46f6a3d579f6' }); }); $('#fblike').html('<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fefreedom.com&layout=standard&show_faces=false&width=300&action=recommend&font=arial&colorscheme=light&height=30" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:30px;" allowTransparency="true"></iframe>'); });</script>
-
-
- <hr />
-
- <a name="additionalAnswersMarker"></a>
- <div id="searchAdditionalAnswers">Find More Answers<br />
-
- <form action="/search" id="cse-search-box2">
- <div>
- <input type="hidden" name="cx" value="partner-pub-5095240990837916:btxr0w-yrgf" />
- <input type="hidden" name="cof" value="FORID:10" />
- <input type="hidden" name="ie" value="UTF-8" />
- <input type="text" name="q" id="txtSearch" style="width: 400px;" maxlength="255" value="" />
- <input type="submit" id="btnSearch" value="Search" />
- </div>
- </form>
- <script type="text/javascript">google.load('search', '1'); $("#q").focus(function () { this.select(); });</script>
- <script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box2&lang=en"></script></div>
- <!-- google_ad_section_end -->
-
- <div id="questionTopics">
- <!-- google_ad_section_start -->
- <div id="questionTopicsTitle">Related Topics<span id="lblQuestionTopics"> <a class='topicBoxSmall' href='/Topic/php/0/'>php</a> <a class='topicBoxSmall' href='/Topic/javascript/0/'>javascript</a> <a class='topicBoxSmall' href='/Topic/facebook/0/'>facebook</a> <a class='topicBoxSmall' href='/Topic/authorization/0/'>authorization</a></span></div>
- <!-- google_ad_section_end -->
- </div>
-
- <!-- google_ad_section_start -->
- <div id="relatedQuestionsTitle">Related Questions</div>
- <div id="relatedQuestions"><ul><li><h2><a href='/Question/1-7764150/Open-Friends-Request-User-Clicks-Allow-Facebook-Connect'>open friends request when user clicks allow in <span class='highlight'>Facebook</span> connect</a></h2><div> I allow users to use facebook connect to login to facebook and then give permission to my app.
- When they click allow I want the multi-friend's selector to open so they can invite friend's to the …</div></li><li><h2><a href='/Question/1-484550/Facebook-Authorization-Problem'><span class='highlight'>Facebook</span> <span class='highlight'>authorization</span> problem</a></h2><div> I'm working on a facebook app and there's something I'm just not understanding about how their authorization system works.
- Our basic setup is this
- canvas URL = domain.com/facebook
- This is a…</div></li><li><h2><a href='/Question/1-6684888/User-Authorization-Facebook'>User Authorization with <span class='highlight'>Facebook</span></a></h2><div> I have implemented Facebook user authentication with my current project and now I would like to implement authorization. I need authorization to check if a user is logged in when they try to perform…</div></li><li><h2><a href='/Question/1-4143045/Facebook-Iframe-Application-Authorization-Redirect-Facebook-Page-Tab'><span class='highlight'>Facebook</span> iframe application after authorization redirect to <span class='highlight'>facebook</span> page tab</a></h2><div> I have problems with redirecting user after authorization back to the app tab in facebook page. I always end up in standalone application canvas page.
-
- Edit:
- It was meant to be an app in tab
- …</div></li><li><h2><a href='/Question/1-6375619/Load-Facebook-Authorization-Immediately'>How to load the <span class='highlight'>facebook</span> <span class='highlight'>authorization</span> immediately?</a></h2><div> I've read a few posts which are similar in nature to this one but the answer I've been seeking hasn't been in any so I'm hoping to address the question in a slightly different manner.
- What I woul…</div></li><li><h2><a href='/Question/1-6994510/Check-User-Already-Authorized-Facebook-Graph-Api-Using-PHP'>How to Check if the User already authorized or not in facebook graph api using <span class='highlight'>PHP</span></a></h2><div> How to Check if the User Already authorized our application using graph API and PHP? I Searched the net for graph api is not avaiable. I need only in graph API...
- </div></li><li><h2><a href='/Question/1-7762907/Authorization-Window-Reopens-Quickly-Closes-Even-Already-Authorized-Avoid'><span class='highlight'>Authorization</span> window reopens then quickly closes even if already authorized. How to avoid this?</a></h2><div> My App on Facebook uses the JavaScript SDK. When a user navigates to my app page and goes to my app, a popup asks them to authorize the app. This works well.
- However, if they authorize the app, t…</div></li><li><h2><a href='/Question/1-6169993/Facebook-RoR-Redirect-Authorization-URL'><span class='highlight'>Facebook</span> and RoR: how to redirect to <span class='highlight'>authorization</span> URL?</a></h2><div> I am trying to redirect the user to the URL which requests permission to access the user's information.
- I have a view with a form whose action goes to the following:
- class AuthController < …</div></li><li><h2><a href='/Question/1-4654796/Can-Get-Facebook-Prompt-Authorization-App-Every-Time'>How can I get <span class='highlight'>facebook</span> to prompt for <span class='highlight'>authorization</span> for my app every time?</a></h2><div> I'm writing an app that will allow a user to log in to multiple facebook accounts. Basically I'm just going to store the authorization token for each account and use them as needed, so the authoriza…</div></li><li><h2><a href='/Question/1-3029060/Handle-User-Authorization-Safest-Way'>How do I handle user <span class='highlight'>authorization</span> the safest way?</a></h2><div> I'm developing a small website where I'm going to allow user to create accounts but I'm quite clueless when it comes to safety around authorizations.
- I have built my project in PHP with codeignit…</div></li></ul></div>
- <!-- google_ad_section_end -->
- </div>
-
- </div>
- <script type="text/javascript" language="javascript">$(document).ready(function () { prettyPrint(); });</script>
-
- </div>
- <div id="footer">
- <div id="footerContent">
-
-
- <br /><br />
-
-
- <div id="attribution">The <a href="/Questions/0/">questions</a>, <a href="/Topics/0/">topics</a> and answers come from technology related content via a <a href='http://stackexchange.com' target='_blank'>stackexchange.com</a> <a href='http://blog.stackoverflow.com/category/cc-wiki-dump/' target='_blank'>public data dump</a> and are licensed under the <a href='http://creativecommons.org/licenses/by-sa/2.5/' target='_blank'>cc-wiki</a> license.</div>
- <p>Logo, design and layout © 2009 eFreedom.com</p>
- <p></p>
- <span id="renderedAt"></span>
- </div>
- </div>
- </div>
- <form id="form1" action="/"></form>
- <script type="text/javascript" language="javascript">var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-4332911-7']); _gaq.push(['_setDomainName', 'efreedom.com']); _gaq.push(['_trackPageview']); (function () { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();</script>
- </body>
- </html>