Skip to main content
This guide walks through implementing social login using server-side redirects with the Median JavaScript Bridge. Use this approach when you want to handle authentication through your backend API, keeping token validation and session management secure on your server. Before you start You’ll need:
  • A backend API endpoint that can receive GET requests with tokens and session details as URL parameters
  • The ability to parse JWT tokens on your server to extract user details
  • Your server configured to create login sessions for authenticated users
  • Your social login providers already configured (Facebook, Google, and/or Apple)

Understanding the parameters

Each social login method accepts these parameters:
  • redirectUri (required): Your backend API endpoint URL. After login completes, the webview redirects here with the authentication token added as a URL parameter.
  • scope (optional): Defines what user data your app can access. Each provider has different scope options:
  • state (optional): An optional string you supply to verify the request came from your app. We’ll pass this back to you unchanged. Use it to prevent CSRF attacks.
Here’s the basic syntax for each provider:

What you’ll receive

When login succeeds, your redirectUri receives the authentication tokens as URL parameters. If the user cancels the login process, the error parameter will contain an error message. Redirect URL API endpoint parameters Apple only includes firstName and lastName on the user’s first login. See Platform-specific requirements.

Platform-specific requirements

Apple only sends complete user profile data (firstName, lastName, email) on the first login. After that, you only get a JWT token and a user identifier.Here’s what to do:
  • Save the full user profile to your database during the first authentication
  • On subsequent logins, retrieve the stored profile using the user identifier from the JWT
  • Parse the JWT for additional fields like email and email_verified
Read Apple’s documentation on retrieving user information

Implementation

Use the Median JavaScript Bridge methods to trigger native login from your website. When a user clicks the button, the native login flow starts. After they authenticate, the webview redirects to your endpoint with the authentication token as a URL parameter. Here are examples for each platform:

Add the login button

Configure your backend

Your backend server must be configured to accept the authentication token, parse it as a JWT to access the user details, and create a login session for the user. Always verify the token on your server before trusting it. Each provider documents how:
Last modified on November 7, 2026