Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7530625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:57:44+00:00 2026-05-30T04:57:44+00:00

My Code: $url = $fb->getLoginUrl(array(‘scope’=>’email’,’next’=>’http://apps.facebook.com/APPID/’)); echo <script> top.location=\.$url.\; </script>; I need to redirect the

  • 0

My Code:

$url = $fb->getLoginUrl(array('scope'=>'email','next'=>'http://apps.facebook.com/APPID/'));
echo "<script> top.location=\"".$url."\"; </script>";

I need to redirect the user to apps URL of my application when authetication is successfull but it always redirect to my redirect_uri page.

how can i fix it?

thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:57:45+00:00Added an answer on May 30, 2026 at 4:57 am

    You have to change this URL to redirect you app where you want after authentication.

    You have to change this URL to redirect you app where you want after authentication.

    OR You can Do this

    First of all, you don’t have to edit PHP SDK, below is the sample for authenticating the user and then redirecting to your landing page,

    Make sure you replace:

    YOUR-APP-ID-HERE with Your facebook application id,

    YOUR-APP-API-SECRET-HERE with Your facebook application secret key

    YOUR-REDIRECT-URL-HERE with Your landing page URL

    <?php
    
        // Requires Facebook PHP SDK 3.0.1: https://github.com/facebook/php-sdk/
        require ('facebook.php');
    
        define('FACEBOOK_APP_ID',"YOUR-APP-ID-HERE");
        define('FACEBOOK_SECRET',"YOUR-APP-API-SECRET-HERE");
        define('REDIRECT_URI',"YOUR-REDIRECT-URL-HERE");
        $user = null;
    
        $facebook = new Facebook(array(
            'appId' => FACEBOOK_APP_ID,
            'secret' => FACEBOOK_SECRET,
            'cookie' => true
        ));
    
        $user = $facebook->getUser(); // Get the UID of the connected user, or 0 if the Facebook user is not connected.
    
        if($user == 0) {
            // If the user is not connected to your application, redirect the user to authentication page
            /**
             * Get a Login URL for use with redirects. By default, full page redirect is
             * assumed. If you are using the generated URL with a window.open() call in
             * JavaScript, you can pass in display=popup as part of the $params.
             * 
             * The parameters:
             * - redirect_uri: the url to go to after a successful login
             * - scope: comma separated list of requested extended perms
             */
    
            $login_url = $facebook->getLoginUrl($params = array('redirect_uri' => REDIRECT_URI));
    
            echo ("<script> top.location.href='".$login_url."'</script>");
    
        } else {
            // if the user is already connected, then redirect them to landing page or show some content
            echo ("<script> window.location.href='".REDIRECT_URI."'</script>");
        }
    
    ?>
    

    If you want to get extended permissions, then simply add another “scope” parameter to the login url, ex:

    $login_url = $facebook->getLoginUrl($params = array('redirect_uri' => REDIRECT_URI,'scope' => 'comma-separated-list-of-requested-extended-perms'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I run this code url = ('http://maps.google.com/maps/nav?'+ 'q=from%3A'+from_address+ '+to%3A'+to_address+ '&output=json&oe=utf8&key='+api_key) request = urllib2.Request(url)
My Code is String url = http: gd.geobytes.com/gd?after=-1&variables=GeobytesCountry,GeobytesCity; RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL
Here's my code: URL url = new URL(http://www.bing.com/); URLConnection urlConnection = url.openConnection(); BufferedReader in
I have following ajax call in my JavaScript code url = 'http://news.ycombinator.com/?callback=?'; $.ajax({url:url ,async:!1,dataType:'script',
I've an issue with this piece of code: NSURL *url = [[NSURL alloc] initWithString:@http://authenticate.radonsystems.net/products.xml];
I am currently calling the following line of code: java.net.URL connection_url = new java.net.URL(http://<ip
This is my code: $('body').css('cursor','url(http://5211.91.tc/imcur/020.cur),auto'); Thanks
I am facing with problem related Http Connection. MY code : URL url =
I have the following code: url = 'abcdc.com' print(url.strip('.com')) I expected: abcdc I got:
This was my original code: @Url.Action(LoginYoutube, Account, new { returnUrl = Request.QueryString[ReturnUrl] }, http)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.