{"id":18612965,"url":"https://github.com/logto-io/react-native","last_synced_at":"2026-01-29T08:16:49.676Z","repository":{"id":103033422,"uuid":"524078413","full_name":"logto-io/react-native","owner":"logto-io","description":"Build authentication and authorization with Logto React Native SDK.","archived":false,"fork":false,"pushed_at":"2025-04-10T14:59:42.000Z","size":1400,"stargazers_count":5,"open_issues_count":8,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-10T16:02:18.904Z","etag":null,"topics":["android","authentication","authorization","ios","jwt","logto","mfa","multi-tenant","oauth2","oidc","react","react-native","saml","sso"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/logto-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"logto-io"}},"created_at":"2022-08-12T12:25:53.000Z","updated_at":"2025-04-10T14:47:54.000Z","dependencies_parsed_at":"2024-04-18T09:48:23.258Z","dependency_job_id":"d2638fe1-3679-4ec3-a0fa-4dd43b723732","html_url":"https://github.com/logto-io/react-native","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logto-io%2Freact-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logto-io%2Freact-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logto-io%2Freact-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logto-io%2Freact-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logto-io","download_url":"https://codeload.github.com/logto-io/react-native/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248252663,"owners_count":21072699,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","authentication","authorization","ios","jwt","logto","mfa","multi-tenant","oauth2","oidc","react","react-native","saml","sso"],"created_at":"2024-11-07T03:19:17.061Z","updated_at":"2025-10-27T02:06:09.340Z","avatar_url":"https://github.com/logto-io.png","language":"TypeScript","funding_links":["https://github.com/sponsors/logto-io"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://logto.io\" target=\"_blank\" align=\"center\" alt=\"Logto Logo\"\u003e\n    \u003cimg src=\"https://github.com/logto-io/logto/raw/master/logo.png\" height=\"100\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# Logto React Native\n\n[![Discord](https://img.shields.io/discord/965845662535147551?logo=discord\u0026logoColor=ffffff\u0026color=7389D8\u0026cacheSeconds=600)](https://discord.gg/UEPaF3j5e6)\n[![Build Status](https://github.com/logto-io/react-native/actions/workflows/main.yml/badge.svg)](https://github.com/logto-io/react-native/actions/workflows/main.yml)\n\nThe monorepo for Logto React Native (Expo) SDK and sample.\n\n- [@logto/rn](./packages/rn) - Logto React Native SDK\n- [@logto/rn-sample](./packages/rn-sample) - Sample app using Logto React Native SDK\n\n## Installation\n\n```bash\nnpm install @logto/rn\nnpm install expo-crypto expo-secure-store expo-web-browser @react-native-async-storage/async-storage\n```\n\nThe `@logto/rn` package is the SDK for Logto. The remaining packages are its peer dependencies. They couldn't be listed as direct dependencies because the Expo CLI requires that all dependencies for native modules be installed directly within the root project's `package.json`.\n\nYou could also use other package managers such as `yarn` or `pnpm`.\n\n## Configuration\n\nTo make the redirect URI deep link work, you need to configure the `scheme` in the `app.json` file.\n\nFor instance, in the `@logto/rn-sample` we use `io.logto://callback` as the callback URL.\n\n```json\n{\n  \"expo\": {\n    \"scheme\": \"io.logto\"\n  }\n}\n```\n\n## Integration\n\n```tsx\nimport { LogtoProvider, useLogto } from \"@logto/rn\";\n\n// Use `useLogto()` hook to sign in and sign out\nconst Content = () =\u003e {\n  const { signIn, signOut, isAuthenticated } = useLogto();\n\n  return isAuthenticated ? (\n    \u003cButton title=\"Sign Out\" onPress={signOut} /\u003e\n  ) : (\n    \u003cButton title=\"Sign In\" onPress={async () =\u003e signIn(redirectUri)} /\u003e\n  );\n};\n\n// Wrap your page component with `LogtoProvider`\nconst App = () =\u003e {\n  const logtoConfig = {\n    appId: \"YOUR_APP\",\n    endpoint: \"YOUR_LOGTO_ENDPOINT\",\n  };\n\n  return (\n    \u003cLogtoProvider config={logtoConfig}\u003e\n      \u003cContent /\u003e\n    \u003c/LogtoProvider\u003e\n  );\n};\n```\n\n## Run the sample app\n\n\u003e [!Note]\n\u003e In terms of the redirect URI scheme, different platforms have different requirements.\n\u003e\n\u003e - For native platforms, a Private-Use native URI scheme is required. See [OAuth2 spec](https://datatracker.ietf.org/doc/html/rfc8252#section-8.4) for more details.\n\u003e - For web platforms (SPA), an `http(s)://` scheme is required.\n\u003e\n\u003e You may need to register different applications in the Logto dashboard for different platforms. Make sure to configure the correct `redirectUri` and `clientId` for different platforms.\n\n### Replace the `appId` and `endpoint` in `App.tsx` with your own Logto settings.\n\n```tsx\nconst endpoint = \"YOUR_LOGTO_ENDPOINT\";\nconst appId = \"YOUR_APP_ID\";\n```\n\n### Development using Expo Go\n\n#### For iOS\n\nCustomize the redirect URI e.g. `io.logto://callback` and pass it to the `signIn` function.\n\nRun the following command under the path `packages/rn-sample`.\n\n```bash\npnpm dev:ios\n```\n\n#### For web\n\nCustomize the redirect URI e.g. `http://localhost:19006` and pass it to the `signIn` function.\n\nRun the following command under the path `packages/rn-sample`.\n\n```bash\npnpm dev:web\n```\n\n#### For Android\n\n\u003e [!Caution]\n\u003e This SDK is not compatible with \"Expo Go\" sandbox on Android.\n\u003e Expo Go app by default uses `exp://` scheme for deep linking, which is not a valid private native scheme. See [OAuth2 spec](https://datatracker.ietf.org/doc/html/rfc8252#section-8.4) for more details.\n\u003e For Android, Use [development-build](https://docs.expo.dev/develop/development-builds/introduction/) to test this SDK\n\n### Build and run native package\n\nUnder the path `packages/rn-sample` run the following command.\n\n```bash\n# Run expo\npnpm expo run\n\n# Directly run on android device\n# pnpm android\n\n# Directly run on ios device\n# pnpm ios\n```\n\n## Resources\n\n- [📖 Logto docs](https://docs.logto.io/?utm_source=github\u0026utm_medium=repo_logto)\n- [✍️ Blog](https://blog.logto.io/?utm_source=github\u0026utm_medium=repo_logto)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogto-io%2Freact-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogto-io%2Freact-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogto-io%2Freact-native/lists"}