expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
35.06k stars 5.62k forks source link

[SDK 43, expo-auth-session, expo-web-browser] https schemed redirectURI does not callback to app #17358

Closed zgordon02 closed 2 years ago

zgordon02 commented 2 years ago

Summary

I have a bare app and I am trying to go through an oauth flow. When using my bundle identifier as my redirect's scheme everything works fine. However, when I use https as the scheme, the browser never closes.

When I manually open/ close an auth session using WebBrowser (example in reproducible demo), everything works. This tells me that https linking for my app is working, but expo is having issues handling the https redirect.

Please note that in all cases I am able to authenticate with the oauth provider so that is not in question. What is in question is the redirect not closing the browser properly

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

bare

What platform(s) does this occur on?

Android, iOS

SDK Version (managed workflow only)

No response

Environment

expo-env-info 1.0.3 environment info: System: OS: macOS 12.3.1 Shell: 5.8 - /bin/zsh Binaries: Node: 16.9.1 - ~/.nvm/versions/node/v16.9.1/bin/node Yarn: 1.22.17 - ~/.nvm/versions/node/v16.9.1/bin/yarn npm: 7.24.0 - ~/.nvm/versions/node/v16.9.1/bin/npm Watchman: 2022.03.14.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 IDEs: Android Studio: Bumblebee 2021.1.1 Patch 1 Bumblebee 2021.1.1 Patch 1 Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild npmPackages: expo: ^43.0.0 => 43.0.4 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.2 => 0.64.2 react-native-web: 0.17.1 => 0.17.1 npmGlobalPackages: expo-cli: 5.0.3 Expo Workflow: bare

Reproducible demo

What works:


  await WebBrowser.openAuthSessionAsync(
    authUrlData?.data,
    'https:/some-domain.net'
  );

// ...

  useEffect(() => {
    Linking.addEventListener('url', e => {
      const parsedURL = new URL(e.url);

      setFinalCode(parsedURL?.searchParams.get('code'));
      setFinalState(parsedURL?.searchParams.get('state'));

      WebBrowser.dismissAuthSession();
    });
    return () => {
      Linking.removeEventListener('url', e => {});
    };
  }, []);

what does NOT work:

  const [request, response, promptAsync] = useAuthRequest(config, {
    authorizationEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth',
  });

// ...

    const result = await authorize(integrationItemConfig);

    setAuthResult(result);
github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] commented 2 years ago

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

LeunensMichiel commented 2 months ago

This is still an issue. Universal Linking should be supported out of the box