- TypeScript 93%
- JavaScript 5%
- Docker 2%
midi club #
This is an Expo project created with create-expo-app, and adapted to include a starter template for building Atmosphere apps, with OAuth authentication using the @atproto/oauth-client-expo library, based on the Authentication in Expo Router guide.
Get started #
This app requires a development build on iOS and Android. Expo Go does not include the ExpoAtprotoOAuthClient native module used for authentication.
This project uses pnpm. Enable it with corepack enable if needed; Corepack uses the version pinned in package.json.
-
Install dependencies
pnpm install -
Choose an OAuth environment, then build and install the app in the iOS simulator
open -a Simulator pnpm iosLocal iOS builds require macOS, Xcode 26.4 or later, and an installed iOS simulator runtime. Install a runtime in Xcode Settings under Components if needed. Simulator builds do not require Apple development signing. The first build installs CocoaPods dependencies and can take several minutes.
To choose a simulator, run
pnpm ios --deviceand select a simulator from the list. For a connected iPhone, select that device instead; device installation requires Apple development signing and Developer Mode. The project enables scene support for builds made with Xcode 27.For Android, use
pnpm android. These commands build the native app and start Metro. Rebuild after adding native dependencies or upgrading the Expo SDK. -
Start Metro for subsequent sessions
pnpm start
Press i in the Metro terminal to open the installed development app in the iOS simulator. pnpm start targets that app. For the browser version, run pnpm web.
You can start developing by editing the files inside the app directory. This project uses file-based routing.
Usage #
OAuth environments #
The ExpoOAuthClient in utils/oauthClient.ts uses https://bsky.social to resolve handles. Adjust the metadata scope to the app's needs. See the AT Protocol OAuth specification for client metadata requirements.
Sign a user in #
The SessionContext context provides a signIn(input) method that can be used to sign a user in. The SignInForm component in components/SignInForm.tsx provides a simple UI for signing in with a handle.
input must be one of the following:
- A valid Atproto user handle, e.g.
hailey.bsky.teamorhailey.at - A valid DID, e.g.
did:web:hailey.atordid:plc:oisofpd7lj26yvgiivf3lxsi - A valid PDS host, e.g.
https://cocoon.hailey.atorhttps://bsky.social
Making authenticated requests #
Once a user is signed in, you can create an Agent instance using the OAuth session.
The PdsAgentProvider component in components/PdsAgentProvider.tsx demonstrates how to create an Agent that can be used to make authenticated requests to the user's PDS.
The BskyAgentProvider component in components/BskyAgentProvider.tsx demonstrates how to create a BskyAgent that can be used to interact with a dedicated appview (the Bluesky public API in this case).
An example of using both agents can be found in app/(authenticated)/index.tsx.
Possible improvements #
Currently, the SessionProvider only stores the latest used account (in order to restore the session on app restart). This could be improved by storing multiple accounts and allowing the user to switch between them.
Links #
The following resources might help you get started:
- Authentication in Expo Router: How to implement authentication and protect routes with Expo Router.
- Expo documentation: Learn how to utilize the expo-auth-session library to implement authentication with OAuth or OpenID providers. (Note: AT flavoured OAuth is not compatible with OpenID Connect).