Skip to content

Add app sign-in

App sign-in is for the people who use your app, with the accounts in your Supabase project. It is separate from your Ynch account. It needs a Supabase connection.

In .ynch/connections.json, add userAuth and name the field that holds the user’s id on your tables:

{
"schemaVersion": "1.0.0",
"connections": {
"primary": {
"cloudConnectionId": "conn_main",
"provider": "supabase",
"userAuth": { "userColumn": "user-id" }
}
}
}

user-id here means the database column user_id.

2. Use the column in your models and operations

Section titled “2. Use the column in your models and operations”

For a table that holds per-user rows, include the user field in the model and in the operation’s columns. For example, a progress table with user_id:

  • When the app reads, Studio adds a filter so a user only gets rows where user_id is their own id.
  • When the app inserts, Studio fills user_id with the signed-in user’s id. The app cannot set it to someone else’s.

Requests also carry the user’s own Supabase session, so your row level security policies (for example auth.uid() = user_id) apply as they would in any Supabase app.

Upload, approve and activate as usual. Studio then shows Database settings have changed: accepting turns app sign-in on and approves the operations in one step.

When the app needs a signed-in user, it shows a sign-in screen with email and password. The session is kept in the iPhone’s Keychain and renewed automatically. The app’s detail screen in Ynch has a sign-out row.

  • Supabase only.
  • Email and password sign-in for existing accounts. Sign-up and password reset happen in your own Supabase flows.