{"id":28643460,"url":"https://github.com/streamplace/atproto-oauth-client-react-native","last_synced_at":"2025-06-25T17:11:07.357Z","repository":{"id":265575057,"uuid":"896274011","full_name":"streamplace/atproto-oauth-client-react-native","owner":"streamplace","description":"@aquareum/atproto-oauth-client-react-native","archived":false,"fork":false,"pushed_at":"2025-01-03T22:00:26.000Z","size":91,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-12T23:03:25.475Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@aquareum/atproto-oauth-client-react-native","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamplace.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-11-29T23:47:25.000Z","updated_at":"2025-05-18T09:37:22.000Z","dependencies_parsed_at":"2024-11-30T01:18:34.293Z","dependency_job_id":"01ac2afb-3794-4656-8414-398eb6bf9bfb","html_url":"https://github.com/streamplace/atproto-oauth-client-react-native","commit_stats":null,"previous_names":["aquareum-tv/atproto-oauth-client-react-native","streamplace/atproto-oauth-client-react-native"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/streamplace/atproto-oauth-client-react-native","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamplace%2Fatproto-oauth-client-react-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamplace%2Fatproto-oauth-client-react-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamplace%2Fatproto-oauth-client-react-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamplace%2Fatproto-oauth-client-react-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamplace","download_url":"https://codeload.github.com/streamplace/atproto-oauth-client-react-native/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamplace%2Fatproto-oauth-client-react-native/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261917439,"owners_count":23229919,"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":[],"created_at":"2025-06-12T23:02:27.938Z","updated_at":"2025-06-25T17:11:07.346Z","avatar_url":"https://github.com/streamplace.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# atproto OAuth Client for React Native\n\nThis package implements an atproto OAuth client usable on the React Native\nplatform. It uses [react-native-quick-crypto] for cryptographic operations and\n[expo-sqlite] for persistence. Its usage is very similar to the atproto OAuth\nclient for the browser, so refer to that [README] and [example] for general\nusage. Some differences are noted below.\n\n## expo-sqlite\n\nThis library uses [expo-sqlite] to store the OAuth state and session data in a\nSQLite database. The schema is automatically created when the client is\ninstantiated.\n\nBecause this database is storing sensitive cryptographic keys, it is highly\nreccomended to use the optional SQLCipher extension. This can be accomplished in\nyour app.json file:\n\n```json\n{\n  \"expo\": {\n    \"plugins\": [\n      [\n        \"expo-sqlite\",\n        {\n          \"useSQLCipher\": true\n        }\n      ]\n    ]\n  }\n}\n```\n\n## Login and session restore flow\n\nThe basic login flow will involve popping up a web browser and allowing users to\nauthenticate with their selected PDS. This can be accomplished with the\n`expo-web-browser` library:\n\n```tsx\nimport { openAuthSessionAsync } from 'expo-web-browser'\n\n// inside your login onPress, perhaps:\nconst loginUrl = await oauthClient.authorize(pds)\nconst res = await openAuthSessionAsync(loginUrl)\nif (res.type === 'success') {\n  const params = new URLSearchParams(url.split('?')[1])\n  const { session, state } = await oauthClient.callback(params)\n  console.log(`logged in as ${session.sub}`)\n}\n```\n\n## Development on localhost\n\nThe atproto OAuth specification has a special case for development on localhost,\nbut it is required to use a redirectUrl that returns to `127.0.0.1` or `[::1]`.\nThis prevents the localhost OAuth flow from returning you directly to your app.\nAs a workaround, you can host a static HTML server on 127.0.0.1 that recieves\nthe incoming OAuth callback and then redirects to your app. (If you have a web\nversion of your React Native app, you can just use that.) Such a redirect page\nmight look something like this:\n\n```tsx\nimport { useEffect } from 'react'\nimport { View, Text } from 'react-native'\n\nexport default function AppReturnScreen({ route }) {\n  useEffect(() =\u003e {\n    document.location.href = `com.example.app:/app-return${document.location.search}`\n  }, [])\n  return (\n    \u003cView style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}\u003e\n      \u003cText\u003eRedirecting you back to the app...\u003c/Text\u003e\n    \u003c/View\u003e\n  )\n}\n```\n\nThis flow will work on the iOS simulator and on Android devices provided you've\nforwarded the port with `adb reverse`. For testing on iOS hardware, you'll\ninstead need to set up TLS.\n\n[react-native-quick-crypto]:\n  https://github.com/margelo/react-native-quick-crypto\n[expo-sqlite]: https://docs.expo.dev/versions/latest/sdk/sqlite/\n[README]:\n  https://github.com/bluesky-social/atproto/tree/main/packages/oauth/oauth-client-browser\n[example]:\n  https://github.com/bluesky-social/atproto/tree/main/packages/oauth/oauth-client-browser-example\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamplace%2Fatproto-oauth-client-react-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamplace%2Fatproto-oauth-client-react-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamplace%2Fatproto-oauth-client-react-native/lists"}