You can fix the "Redirect Checkpoints" error in Expo Supabase GitHub authentication by ensuring the Redirect URLs in your Supabase project settings match exactly with the fallbackUrl and redirectTo parameters passed to the supabase.auth.signInWithOAuth function in your Expo/React Native app. This error occurs because Supabase cannot verify that the incoming request originates from the URL you authorized, effectively blocking the login flow to prevent open redirect vulnerabilities. The solution involves three specific checkpoints: the Supabase dashboard configuration, the Expo client code invocation, and the build configuration (if using EAS). If the URL strings do not match character-for-character, including protocol (http vs https), domain, and port, Supabase will reject the callback. Before beginning, you must have a working Expo project initialized with the Supabase client library and a GitHub OAuth application created.

What You'll Need

  • A GitHub account with an existing OAuth App created (or the ability to create one) and the Client ID and Client Secret handy.
  • A Supabase project created (one is included with the Supabase CLI start command).
  • An Expo project initialized using expo init or created via EAS Build with the @supabase/supabase-js package installed (npm install @supabase/supabase-js).
  • Node.js and NPM/Yarn installed on your development machine.
  • Basic familiarity with React Native navigation (React Navigation) and Expo environment variables.

Step-by-Step

  1. Verify the Supabase Redirect URLs. Log in to your Supabase project dashboard. Navigate to the Authentication section and then select the Providers tab. Find the GitHub provider and click on it. Locate the Redirect URLs field. This is the first checkpoint. You must add every URL that the user might be redirected to after a successful GitHub login. For a standard Expo development environment, this is exp://your-expo-app-name.expo.dev and exp+notifee://your-expo-app-name.expo.dev (if using the Notifee library). If you are using EAS Build for production, you must add your-app-id://auth/callback, where your-app-id is the bundle identifier of your app. Ensure there are no trailing slashes unless your app specifically handles them. Copy these URLs exactly as they appear; they are case-sensitive.
  2. Configure the GitHub OAuth App. Go to the GitHub Developers page. Select your OAuth App. Locate the Authorization callback URL field. This must match the Redirect URLs you added in the Supabase dashboard. For Expo development, this is exp://your-expo-app-name.expo.dev/**. The trailing wildcard /** is crucial in the GitHub developer settings because Supabase generates a randomized path string after the domain during the authentication process. Without the wildcard, GitHub will reject the callback because the URL won't match the exact string stored in its settings. Save the changes on the GitHub page.
  3. Update Client Application Code. Open your Expo project in your code editor. Locate the file where you initialize the Supabase client (usually supabaseClient.ts or similar) and the file where you trigger the login (usually a screen component). Ensure your signInWithOAuth call is using the correct options object. The redirectTo option is the second checkpoint. Set it explicitly to one of the URLs you added in step 1. For example, redirectTo: 'exp://your-expo-app-name.expo.dev'. The options object should look like this:
    const { data, error } = await supabase.auth.signInWithOAuth({
          provider: 'github',
          options: {
            redirectTo: 'exp://your-expo-app-name.expo.dev',
            scopes: 'read:user user:email',
          },
        })
    Do not rely on the default behavior of the library to guess the redirect URL, as it often defaults to the app's bundle identifier which might be formatted differently (e.g., com.example.app vs example-app://). Hardcoding the redirectTo ensures you have control over the exact string Supabase will use for the callback.
  4. Configure the Expo Manifest (EAS Build). If you are building your app with EAS Build and encountering the error on a production or preview build, the third checkpoint is the Expo configuration. Open your app.json or app.config.js file. You must ensure that the scheme property matches the redirectTo string you used in step 3. For example, if your redirectTo is set to exp://your-app-name.expo.dev, your app.json should contain:
    {
          "expo": {
            "scheme": "exp"
          }
        }
    This tells the operating system to register your Expo URL scheme so it can handle the incoming callback from Supabase. If this is missing or incorrect, the OS will not know how to open your app when Supabase redirects back, causing the redirect checkpoint to fail.
  5. Clean and Rebuild. After making these changes, the error will likely persist until the environment variables and cached configurations are cleared. Run npm start -- --clear in your terminal to clear the Metro bundler cache. If using EAS, you may need to clear the EAS build cache or simply start a new build with eas build --profile preview. The error is a result of a mismatch between the server-side configuration (Supabase) and the client-side invocation (React Native). Only by ensuring all three checkpoints align and restarting the environment will the authentication flow complete successfully.

Common Mistakes

  • Using a trailing slash in the Redirect URL. A common error is adding a slash to the end of the URL in the Supabase dashboard, such as exp://app.expo.dev/. Supabase will append its own path to the URL, resulting in exp://app.expo.dev//some-path. This mismatch causes the redirect checkpoint to fail. Ensure the URL is clean and has no trailing slash.
  • Mixing up the GitHub and Supabase URLs. The Authorization callback URL in GitHub must match the Redirect URLs in Supabase, not the other way around. They are separate systems. If you put the Supabase URL in the GitHub settings, GitHub will reject the callback because it doesn't recognize that domain as a valid endpoint for your app.
  • Neglecting the wildcard in GitHub settings. Some developers forget the /** wildcard in the GitHub Authorization callback URL. Without it, the redirect will fail because Supabase generates a dynamic path during the login process, and GitHub will see a URL that it doesn't have explicitly whitelisted.
  • Forgetting the redirectTo option in code. Relying on the library's default behavior is risky. If the library defaults to your bundle identifier but your Supabase dashboard is configured for exp://, the redirect will fail. Always explicitly set the redirectTo option to match your Supabase configuration.

Tips

  • Use Environment Variables. Do not hardcode the redirectTo string in your application code. Define a constant in your environment configuration file (e.g., .env) and reference it in your code. This makes it easier to switch between development and production environments without changing the code.
  • Check the Console Logs. When the error occurs, open your Expo console. The error message will often include the redirect_uri that Supabase is trying to use. Compare this URL with the one you configured. They should be identical. This is the fastest way to identify a typo or a missing character.
  • Ensure HTTPS is used where possible. While Expo development uses http:// or the exp:// scheme, production builds should use HTTPS. If you are testing a production build and your Supabase dashboard is configured for https://, but your redirectTo uses a non-secure protocol, the redirect will fail. Ensure the protocol matches the environment you are building for.
  • Verify the Supabase URL. Ensure you are using the correct Supabase URL for your project. If you are using a custom domain, the redirectTo must include that custom domain. If you accidentally use the production URL in your development environment, the redirect will fail because the browser will try to navigate to a production URL, which is unreachable from a development machine.

Troubleshooting

If you have followed the steps above and are still encountering the Redirect Checkpoints error, proceed with these checks in order:

  • Verify the Bundle Identifier. If you are using EAS Build and your app.json specifies a bundleIdentifier (e.g., com.mycompany.myapp), ensure your redirectTo in the code uses the corresponding scheme (e.g., myapp://). The mismatch between the Expo scheme and the Bundle Identifier scheme is a frequent cause of this error.
  • Check for DNS Resolution Issues. If you are using a custom domain, ensure that the domain is correctly resolving to your Supabase instance and that your local machine can reach it. Sometimes, network firewalls or VPNs can block the connection, causing the redirect to appear as if it failed.
  • Review the Supabase Logs. Go to the Supabase dashboard and navigate to the Authentication section. Click on the Logs tab. Look for the specific authentication event that failed. The error message will provide more detail than the one shown in the Expo console. It might indicate that the redirect_uri is malformed or that the app ID is invalid.
  • Disable the GitHub App temporarily. If the error persists, temporarily disable the GitHub provider in your Supabase project. This will force Supabase to use a different provider, such as Google or Email. If the error goes away, you know the issue is specifically with the GitHub configuration and not the general Supabase setup.
  • Check for URL Encoding. If you are using a dynamic URL or a URL with special characters, ensure it is properly URL-encoded. For example, a space should be replaced with %20. If you are manually constructing the redirectTo string, ensure you are not introducing encoding errors.

Frequently Asked Questions

Why does Supabase require a redirect URL?

Supabase requires a redirect URL to prevent open redirect vulnerabilities. When a user logs in with a third-party provider like GitHub, the provider sends the user back to your application. Supabase needs to verify that this return trip is authorized and that the user is being sent to a legitimate destination, preventing attackers from hijacking the authentication flow.

Do I need to add the redirect URL to both Supabase and GitHub?

Yes. You must add the URL to the Redirect URLs field in the Supabase dashboard and the Authorization callback URL field in the GitHub Developer settings. Both must match for the authentication flow to complete successfully.

What is the wildcard /** for in GitHub settings?

The wildcard allows GitHub to accept any path after the domain. Supabase generates a random path string during the authentication process, such as /auth/callback/callback-token. Without the wildcard, GitHub would reject the request because the URL would not match the exact string stored in its settings.

Can I use a localhost URL for development?

Yes, you can use http://localhost:19006 (the default Expo port) as a redirect URL. However, this only works if you are using an Expo Go app on a physical device or an emulator that can access your local machine's network. It is generally recommended to use the exp:// scheme for development as it is more reliable and doesn't require port forwarding.

How do I test the redirect URL?

The best way to test is to simulate the login process. You can do this by calling the signInWithOAuth function in your code and then copying the URL from the generated url property of the response. Paste this URL into a web browser. If the URL is correct, it will take you to the GitHub login page. If it is incorrect, you will see an error page.

Does the redirect URL need to be HTTPS?

For production apps, yes. HTTPS is required to secure the authentication process. For development, http:// or the exp:// scheme is acceptable. However, ensure that the protocol you use in your code matches the protocol you configured in the Supabase dashboard.