How to Configure PlanetScale IAM Authentication
You set up planetscale iam authentication by linking your identity provider and mapping database roles. Your team then logs in with short tokens instead of static database passwords. Most teams start by creating broad admin or writer roles for their developers. When roles are too broad, one bad query can drop tables or expose private rows. How planetscale iam authentication works in practice PlanetScale uses a control plane to manage who can reach each database branch. You start by linking yo
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up planetscale iam authentication by linking your identity provider and mapping database roles. Your team then logs in with short tokens instead of static database passwords. Most teams start by creating broad admin or writer roles for their developers. When roles are too broad, one bad query can drop tables or expose private rows.
How planetscale iam authentication works in practice
PlanetScale uses a control plane to manage who can reach each database branch. You start by linking your corporate identity provider to the platform through single sign-on. This link lets the platform check who a user is before granting a session. Once a user logs in, the platform checks their assigned group and role.
For apps and automated jobs, teams use service tokens instead of human accounts. You create a service token and grant it specific rights on a database branch. The app holds this token and uses it to ask for database access. You can also set up branch passwords that tie back to specific access levels.
Database roles split permissions into clear tiers like reader, writer, or admin. A reader role can run select queries on the branch data. A writer role can insert, update, or delete rows across the tables. An admin role can alter schemas, manage branches, and change database settings.
What native roles solve and what they miss
Native identity setup solves the problem of shared, long-lived database passwords. When an engineer leaves the team, you disable their account in the identity provider. They lose access to the database right away without a password rotation. Service tokens also let you revoke access for one app without breaking others.
Still, native access setup only checks who logs in at the start of a session. Once a session begins, the database trusts every command that matches the broad role. A developer with a writer role can update a single row or wipe a table. The login check cannot tell the difference between a safe fix and a mistake.
Service-to-Service Authentication + AWS IAM Policies: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Broad read roles also expose sensitive fields inside your production tables. Anyone with read access can pull customer emails, phone numbers, or card numbers. Native roles apply to the whole branch, not to individual queries in flight. You need query-level checks and field masking to control what happens during an active session.
Best practices for scoping database roles
Start by giving human users read-only roles on production database branches. Require engineers to test schema changes on isolated development branches first. Separate service tokens so each app only touches the database it needs. Rotate service tokens on a set schedule and remove unused tokens right away.
Even with strict roles, some engineers will need write access during live incidents. Relying on static roles alone leaves those emergency sessions wide open to human error. Pairing identity login with query inspection closes the gap between login and execution. Masking rules can also rewrite emails and national IDs in query results.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev sits inline in the wire protocol beside those services as an open-source proxy, a sidecar for your Postgres or API. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Can I use my identity provider for PlanetScale database logins?
Yes, you can link your identity provider using single sign-on to manage team accounts. Users log in through your provider and get database branch access based on their roles.
How do apps log in without a human user account?
Apps use service tokens or branch passwords that you create in the platform. You assign specific branch permissions to each token so the app can read or write data.
Does IAM login hide sensitive data like emails or card numbers?
No, native login roles only decide if a user can connect to the database branch. To rewrite emails, phone numbers, or card numbers in results, you need data masking.
Related guides
In this post