Is @okta/okta-react-native compatible with Expo?

Hello!

Title, basically. I’ve been struggling to implement this, i always have the same warning saying that functions like submit or createConfig does not exist.

The only possible reason i see is because i can’t run react-native link @okta/okta-react-native.
My current solution is to eject the app from Expo and work with react-native only.

While i go this way i want your opinion on it. Is it compatible?

1 Like

Same here. Reactnative app using Typescript. After expo eject, okta-react-native library starts working. Wonder if okta supports expo.

Posting here in case it helps someone else down the line: Expo is now (mostly) supported thanks to the recent-ish addition of native module support through expo dev client. This does unfortunately mean Expo Go is no longer available once the SDK is added, but after the development build is made with the additional dev client dependency, the process is largely the same. iOS essentially works out of the box, but some extra effort is needed to successfully make builds for Android, using expo config-plugins:

First, make a new plug-in to add the required appAuthRedirectScheme value to the app gradle:

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

module.exports = function withCustomAppBuildGradle(config) {
    return withAppBuildGradle(config, (config) => {
      if (
        config.modResults.contents.includes(
          `manifestPlaceholders = [appAuthRedirectScheme: 'com.sampleapplication']`
        )
      ) {
        return config;
      }
  
      config.modResults.contents = config.modResults.contents.replace(
        `versionName "1.0.0"`,
        `versionName "1.0.0"
        manifestPlaceholders = [appAuthRedirectScheme: 'com.sampleapplication']`
      );
      return config;
    });
  }

To leverage the plugin, add it to the app.json config like so:

"expo": {
    "plugins": [
      ["./plugins/withCustomAppBuildGradle"]
    ]
}

Then, follow the Expo documentation for making a development (or production build) to install on your simulator or test device. You can then launch and test your code using expo start --dev-client. I was able to successfully implement the custom sign in flow using okta-react-native v2.7.0 with this approach

My app when Okta Verify opens and I press it’s me, the app goes back to the first page and doesn’t go in, it’s in a loop. Can you help me?