Close Menu
GeekBlog

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Quantum Immortality Is Going Viral as “the Most Horrifying Idea Ever.” Here’s Why Physicists Aren’t Losing Sleep.

    November 18, 2026

    Huawei Watch Air Leaks at 6.9mm: A Titanium Smartwatch Thinner Than a Fitness Band, With a 5-Day Battery

    November 18, 2026

    Grindr’s $120-a-Month Edge Tier Uses AI to Guess Who Will Reply. Its CEO Says Not Everyone Should Buy It.

    November 18, 2026
    Facebook
    GeekBlog
    • Home
    • Mobile
    • Tech News
    • Blog
    • Gaming
    • Smartwatch
    • How-To Guides
    • AI & Software
    Facebook
    GeekBlog
    Home»Blog»How to Integrate Facebook Login Into My Website or App
    Blog

    How to Integrate Facebook Login Into My Website or App

    Ethan CaldwellBy Ethan CaldwellSeptember 9, 202611 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    Smartphone showing the Facebook login screen
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link

    To integrate Facebook Login into a website or app, you create an app in the Meta for Developers dashboard, add the Facebook Login product, run the login flow on the client with the JavaScript SDK or the native iOS and Android SDKs, and then verify the resulting access token on your server before you trust it. The client side is a few dozen lines. The parts that trip most teams up are the server side token check, the App Review process for anything beyond basic profile data, the mandatory data deletion callback, and the newer Limited Login mode on iOS.

    Quick answer: Create a Meta app, enable Facebook Login, whitelist your domains and redirect URIs, call FB.login() (web) or the native SDK login manager (mobile), send the access token to your backend, and validate it there with the Graph API debug_token endpoint using your app access token. Request only public_profile and email unless you are ready for App Review, and register a data deletion callback URL before you go live.

    This guide walks through the whole facebook login integration in the order you will actually build it: dashboard setup, the browser flow, backend validation, permissions and review, the mobile SDKs, the data deletion requirement, and the errors you will hit along the way. Endpoint examples use Graph API version v25.0, which is the version Meta’s own manual flow documentation currently shows; swap in whatever version your dashboard lists as current.

    Step 1: Set up the app in the Meta developer dashboard

    Everything starts at developers.facebook.com. Sign in, open My Apps, click Create App, and pick the use case that includes authentication (the dashboard currently phrases this as “Authenticate and request data from users with Facebook Login”). Give the app a name and a contact email, then finish the wizard.

    Once the app exists, do these things under App settings > Basic and the Facebook Login product settings:

    • Copy the App ID (public, goes in client code) and the App Secret (private, backend only).
    • Add your production domain under App Domains and add a Privacy Policy URL and Terms of Service URL. Live mode will refuse to switch on without a privacy policy.
    • Under Facebook Login > Settings, add every redirect URI you will use to Valid OAuth Redirect URIs. Localhost is allowed while the app is in development mode.
    • Fill in the Data Deletion field (callback URL or instructions URL). More on this below.
    Note: A new app starts in development mode, where only admins, developers and testers can log in. Live mode requires the privacy policy, icon, category and data deletion details.

    Step 2: The JavaScript SDK flow on a website

    For a plain website, load the SDK, initialize it with your App ID, and call FB.login() from a click handler. Browsers block popups that are not triggered by a user gesture, so never fire the login call on page load.

    <script async defer crossorigin="anonymous"
      src="https://connect.facebook.net/en_US/sdk.js"></script>
    <script>
    window.fbAsyncInit = function () {
      FB.init({
        appId: 'YOUR_APP_ID',
        cookie: true,
        xfbml: false,
        version: 'v25.0'
      });
    };
    
    document.getElementById('fb-login').addEventListener('click', function () {
      FB.login(function (response) {
        if (response.status === 'connected') {
          var token = response.authResponse.accessToken;
          fetch('/auth/facebook', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({ access_token: token })
          });
        } else {
          console.log('User cancelled or did not fully authorize.');
        }
      }, { scope: 'public_profile,email' });
    });
    </script>

    The callback returns a short lived user access token. Send it to your backend over HTTPS and never trust the user ID that arrives from the browser; anyone can post a fabricated response to your endpoint.

    If you do not want the SDK on your page at all, Meta documents a manual redirect flow: send the user to https://www.facebook.com/v25.0/dialog/oauth with client_id, redirect_uri, state and scope, then exchange the returned code at https://graph.facebook.com/v25.0/oauth/access_token using your app secret on the server. Use that pattern if you are building a broader single sign on layer with Facebook.

    Step 3: Validate the token on your server

    The single most important step in the whole integration is the server side check. Call the Graph API debug_token endpoint, passing the token you received as input_token and an app access token (the string APP_ID|APP_SECRET) as access_token.

    Recommended for you:

    How to Embed TikTok Videos on a Website or App
    Blog·Sep 9, 2026

    How to Embed TikTok Videos on a Website or App

    GET https://graph.facebook.com/debug_token
        ?input_token=USER_TOKEN_FROM_CLIENT
        &access_token=APP_ID|APP_SECRET
    
    {
      "data": {
        "app_id": "123456789012345",
        "type": "USER",
        "application": "My Store",
        "expires_at": 1762000000,
        "is_valid": true,
        "issued_at": 1756800000,
        "scopes": ["email", "public_profile"],
        "user_id": "10223456789012345"
      }
    }

    Your backend should reject the login unless all of the following are true: is_valid is true, app_id matches your own App ID (this blocks tokens minted for someone else’s app), and expires_at is in the future. Only then fetch the profile:

    GET https://graph.facebook.com/v25.0/me
        ?fields=id,name,email
        &access_token=USER_TOKEN
        &appsecret_proof=HMAC_SHA256(USER_TOKEN, APP_SECRET)

    Turn on Require App Secret in the app’s Advanced settings so every server call must include appsecret_proof. That way a leaked user token is useless without your secret. Note that email can be missing even when the permission was granted: users who signed up with a phone number, or whose email is unverified, return no email field. Handle that case with a fallback form. For a deeper treatment of token lifetimes and refresh strategies, see our guide on handling Facebook API authentication.

    Step 4: Permissions and App Review

    Facebook Login permissions fall into two groups, and the split determines whether you need App Review.

    PermissionWhat it gives youApp Review needed?
    public_profileApp scoped ID, name, profile pictureNo (automatically granted)
    emailPrimary email address if availableNo (automatically granted)
    user_birthday, user_friends, user_likes, and othersExtended profile dataYes, with screencast and justification
    pages_*, instagram_*, ads_*Business asset accessYes, plus Business Verification in most cases

    For a login button, public_profile and email are all you need and they work in live mode without review. Anything else requires a review submission with a use case explanation and a screen recording, which commonly takes days to weeks, so launch with the basic permissions first.

    Tip: Users can uncheck individual permissions in the login dialog. After validating the token, read the scopes array from debug_token (or call /me/permissions) instead of assuming you got everything you asked for. If email was declined you can prompt again with auth_type=rerequest.

    Step 5: iOS and Android native SDKs

    On mobile, use the official SDKs rather than a web view. Meta actively blocks login inside embedded web views, and the native SDKs handle app switching, the system browser, and token storage for you. We cover the general SDK setup in using Facebook SDKs for mobile app development, so here are only the login specifics.

    Android

    Add the facebook-login dependency, put your App ID and Client Token in strings.xml, register the FacebookActivity and the custom tab activity in the manifest, and register your debug and release key hashes in the dashboard. The login itself is a call to LoginManager.getInstance().logInWithReadPermissions(activity, listOf("public_profile", "email")) with a CallbackManager to receive the result. As on the web, send AccessToken.getCurrentAccessToken().getToken() to your backend and validate it there.

    iOS and Limited Login

    On iOS you add the FacebookLogin package, add FacebookAppID, FacebookClientToken and FacebookDisplayName to Info.plist, register the fbAPPID URL scheme, and add fbapi and fb-messenger-share-api to LSApplicationQueriesSchemes. Then call LoginManager().logIn(configuration:).

    The iOS specific twist is Limited Login. When you configure the login with tracking: .limited, the SDK performs a login that does not enable tracking, and instead of a classic access token you receive an AuthenticationToken, which is an OpenID Connect ID token (a JWT). Meta’s documentation notes two consequences: app switching into the Facebook app is not supported for limited flows, and permissions that are incompatible with limited tracking, such as user_likes, cannot be requested. In practice, if your app does not obtain App Tracking Transparency consent, you should build for Limited Login on iOS.

    Because the ID token is a JWT rather than a Graph API token, the server side validation differs. You cannot pass it to debug_token. Instead, verify the signature against Meta’s JWKS at https://limited.facebook.com/.well-known/oauth/openid/jwks/, confirm the iss claim is https://www.facebook.com, confirm aud equals your App ID, check exp, and compare the nonce claim with the nonce your app generated before login. The sub claim is the app scoped user ID.

    # Python example with PyJWT
    import jwt
    from jwt import PyJWKClient
    
    jwks = PyJWKClient("https://limited.facebook.com/.well-known/oauth/openid/jwks/")
    key = jwks.get_signing_key_from_jwt(id_token).key
    claims = jwt.decode(
        id_token, key, algorithms=["RS256"],
        audience=APP_ID, issuer="https://www.facebook.com"
    )
    assert claims["nonce"] == expected_nonce
    user_id = claims["sub"]

    Step 6: The data deletion callback

    Meta requires every app that uses Facebook Login to offer a way for users to request deletion of their data. In App settings > Basic you must supply either a Data Deletion Instructions URL (a page explaining how to request deletion manually) or a Data Deletion Request Callback URL. The callback is the better option because it removes a manual support step.

    When a user removes your app from their Facebook settings and asks for deletion, Meta sends an HTTPS POST to your callback with a signed_request parameter. The value is a base64url encoded HMAC SHA256 signature, a period, and a base64url encoded JSON payload containing algorithm, user_id, issued_at and expires. You verify the signature with your app secret, delete or anonymize everything tied to that user_id, and respond with JSON containing a status URL and a confirmation code:

    {
      "url": "https://example.com/deletion-status?id=abc123",
      "confirmation_code": "abc123"
    }

    The status URL should show the user a human readable explanation of where their request stands; Meta’s data deletion callback documentation has the full contract. Build this before launch, because it is required to move the app to live mode.

    Troubleshooting common errors

    “URL Blocked: This redirect failed because the redirect URI is not whitelisted”

    The redirect_uri you send must match, character for character, one of the Valid OAuth Redirect URIs in Facebook Login settings, including the scheme, trailing slash and any query string. Add the exact URL and try again. Also confirm the domain is in App Domains.

    “Can’t Load URL: The domain of this URL isn’t included in the app’s domains”

    Same root cause as above but for the JavaScript SDK. Add the site domain under App Domains, and if you use the JavaScript SDK make sure the domain is listed under Allowed Domains for the JavaScript SDK in the Login settings.

    “App Not Setup: This app is still in development mode”

    Real users cannot log in while the app is in development mode. Either add them as testers or complete the live mode requirements (privacy policy, data deletion, icon, category) and flip the switch at the top of the dashboard.

    Invalid key hash on Android

    Recommended for you:

    How to Use the TikTok for Developers Documentation
    Blog·Sep 9, 2026

    How to Use the TikTok for Developers Documentation

    Generate the key hash from the exact keystore that signed the build (debug keystore for debug builds, upload key or Play App Signing key for release builds) and register every hash in the dashboard. Play App Signing uses a different key than your upload key, so you usually need both.

    Frequently asked questions

    Do I need App Review just to add a Facebook Login button?

    No. The public_profile and email permissions are granted automatically and work in live mode without review. You only need App Review when you request additional permissions such as friends lists, birthdays, or page and Instagram access, and Business Verification when you touch business assets.

    How long does a Facebook access token last?

    The token returned by the client SDKs is short lived, typically around an hour or two. You can exchange it on the server for a long lived token that lasts roughly sixty days using the fb_exchange_token grant. For plain login you usually do not need this; validate once, then issue your own session.

    Can I use Facebook Login inside a web view in my mobile app?

    No. Meta blocks Facebook Login in embedded web views for security reasons, and the login dialog will error out. Use the official iOS or Android SDK, which opens the system browser or the Facebook app, or use a system browser tab and the manual OAuth redirect flow with a custom URL scheme.

    What is Limited Login and do I have to use it?

    Limited Login is an iOS mode where the SDK performs authentication without enabling tracking and returns an OpenID Connect ID token instead of a Graph API access token. If your app cannot or does not obtain App Tracking Transparency consent, you should use it. Your backend must validate the JWT rather than calling debug_token.

    Is the data deletion callback really mandatory?

    Yes. Meta requires either a data deletion callback URL or a deletion instructions URL in the app’s basic settings, and you cannot switch the app to live mode without one. The callback receives a signed request containing the user ID and must respond with a status URL and confirmation code.

    The bottom line

    A working facebook login integration comes down to four pieces: correct dashboard configuration (domains, redirect URIs, privacy policy, data deletion), a client login flow using the JavaScript SDK or the native SDKs, server side validation with debug_token or JWT verification for Limited Login, and a disciplined approach to permissions so you avoid App Review until you truly need it.

    Get the server side check right first, launch with only public_profile and email, and build the deletion callback before you request live mode. Once login is stable, the same app can power richer social features, such as the Facebook comments plugin, without any additional authentication work.

    About this article: GeekBlog covers U.S. technology news, AI, phones, smartwatches and gaming. Every story is written and checked under our Editorial Policy. Spotted a mistake or have a story tip? Contact our editors.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Telegram Email Copy Link
    Previous ArticleHow to Access a Minikube Service From Outside the Cluster
    Next Article Louisiana or Texas: Which State Is Better to Move To?
    Ethan Caldwell

      Ethan Caldwell is GeekBlog's resident Apple specialist, covering the entire Apple ecosystem: iPhone, iPad, Mac, Apple Watch, AirPods and the software that ties them together. A longtime iOS user and gadget collector, Ethan tracks Cupertino's every move, breaking down Apple keynotes, A- and M-series chip benchmarks, iOS feature updates and the rumor mill into clear, practical takes that help readers decide whether the latest Apple hardware is worth the upgrade.

      Related Posts

      10 Mins Read

      Google Ads Keyword Planner: How It Shows the Most Relevant Keywords

      11 Mins Read

      How to Use Remarketing Techniques for Better Conversions

      11 Mins Read

      How to Conduct A/B Testing for Marketing Campaigns

      10 Mins Read

      AMP for WP Plugin Vulnerability: What Was Fixed and What to Do

      11 Mins Read

      How to Create a Facebook Business Page in 2026

      11 Mins Read

      How to Convert GMT Time to Other Time Zones in C++

      Top Posts

      Every iPhone Camera Ranked in 2026 (Best to Worst)

      July 6, 2026382 Views

      Best Browser for Android in 2026: Top Picks Ranked

      July 7, 2026254 Views

      iPhone Battery Replacement Cost: Every Model, Apple vs Repair Shop

      October 6, 2026200 Views
      Stay In Touch
      • Facebook

      Subscribe to Updates

      Get the latest tech news from FooBar about tech, design and biz.

      Most Popular

      Apple Told Its Stores Not to Expect iPhone Duo Walk-Ins. Carriers Can Beat January by Weeks.

      October 20, 2026317 Views

      Apple Watch Black Friday 2026: Early Deals, Prices to Beat and When to Buy

      November 8, 2026263 Views

      One UI 9 Watch: Which Galaxy Watches Get Wear OS 7, and Who Gets Left Behind

      November 6, 2026167 Views
      Our Picks

      Quantum Immortality Is Going Viral as “the Most Horrifying Idea Ever.” Here’s Why Physicists Aren’t Losing Sleep.

      November 18, 2026

      Huawei Watch Air Leaks at 6.9mm: A Titanium Smartwatch Thinner Than a Fitness Band, With a 5-Day Battery

      November 18, 2026

      Grindr’s $120-a-Month Edge Tier Uses AI to Guess Who Will Reply. Its CEO Says Not Everyone Should Buy It.

      November 18, 2026

      Subscribe to Updates

      Get the latest creative news from FooBar about art, design and business.

      HEICJPG.online - Convert HEIC to JPG online
      Facebook
      • About GeekBlog: Our Mission, Team and Editorial Standards
      • Contact us
      • Privacy Policy
      • Disclaimer
      • Terms and Conditions
      • Editorial Policy
      • Cookie Policy
      • Your Privacy Choices
      © 2026 GeekBlog

      Type above and press Enter to search. Press Esc to cancel.