question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

facebookScheme on Standalone Android is broken, CustomTabActivity doesn't do anything.

See original GitHub issue

🐛 Bug Report

Summary of Issue

  • Cross-post from this forum post.
  • The facebookScheme on standalone Android resolves to a CustomTabActivity that is completely blank and doesn’t do anything.

Environment - output of expo diagnostics & the platform(s) you’re targeting

  Expo CLI 3.24.2 environment info:
    System:
      OS: Windows 10 10.0.18362
    Binaries:
      Node: 12.18.2 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.21.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
      npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      expo: ~38.0.8 => 38.0.9
      react: ~16.11.0 => 16.11.0
      react-dom: ~16.11.0 => 16.11.0
      react-native: https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz => 0.62.2
      react-native-web: ~0.11.7 => 0.11.7

Reproducible Demo

Code is reduced to a single file, one package (expo-auth-session), and only adding the facebook* properties to app.json. See this post.

APK download (available up to 29 days of this post).

Steps to Reproduce

  • expo init minimal typescript
  • expo install expo-auth-session
  • create new facebook project, add login, add https://auth.expo.io/@user/slug
  • copy code from reproducible post
  • make a standalone build

Expected Behavior vs Actual Behavior

  • Web: it works
  • Expo client: it works (using proxy)
  • Android standalone client: clicking “continue” OR “cancel” returns to a second activity with just the app title in an appbar.

Reproduce by running:

adb shell am start -W -a android.intent.action.VIEW -d "fb<FACEBOOKID>://authorize?code=invalid&state=a01bCdEFJK" com.example.app

Other things

Because I had not seen this issue anywhere else, I suspected this was a me problem; but I think it might not be. It’s also not unique to expo-auth-session, as you can tell by the shellscript reproduction.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:49 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
EvanBaconcommented, Nov 19, 2021

Now with EAS Build, you can create custom dev clients and builds that have modified AndroidManifest.xml files. In this case, I would suggest adding the FB scheme directly to the manifest and avoid using facebookScheme which would generate the extra activity that is used in expo-facebook.

withAndroidScheme.js

const { AndroidConfig, withAndroidManifest } = require("@expo/config-plugins");

const withAndroidScheme = (config, scheme) =>
  withAndroidManifest(config, (config) => {
    if (!AndroidConfig.Scheme.hasScheme(scheme, config.modResults)) {
      config.modResults = AndroidConfig.Scheme.appendScheme(
        scheme,
        config.modResults
      );
    }
    return config;
  });

module.exports = withAndroidScheme;

Then in your app.json

{
  "expo": {
    "plugins": [
      ["./withAndroidScheme", "fbMyCustomScheme"]
    ]
  }
}

If you use the vscode-expo extension, you can use <kbd>⌘⇧P</kbd> and type “Expo: Preview modifier” then select “android.manifest” to see a preview of what the AndroidManifest.xml will look like after you build with eas build -p android or expo run:android.

5reactions
SleeplessBytecommented, May 27, 2021

There is no workaround to prevent the double activity. The only workaround is to eject and fix AndroidManifest.xml manually.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Standalone: Android Facebook Auth never returns from com ...
Here is a minimal repro. It will work on web, but it will open the “custom tabs activity” with a blank screen when...
Read more >
Expo-ios / facebook login doesn't work standalone app
I used expo simulator to test the app on both ios and android and they both seem to work, but when I created...
Read more >
Expo Authsession For Fb Login Not Redirecting To ... - ADocLib
Expo can be used to login to many popular providers on iOS Android and web! ... facebookScheme on Standalone Android is broken CustomTabActivity...
Read more >
5 common errors found in a React Native app (using Expo)
When creating a mobile app with React Native, you can use Expo to streamline some ... doesn't work on Android the same way...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found