Embedded login or redirect login: which fits your Medplum app
Both options use the same OAuth2 authorization code flow with PKCE, so the decision is about branding and where the email and password are entered. With the redirect flow, your app sends the user to Medplum's hosted login page, the user signs in there, and Medplum returns an authorization code to your app. With the embedded login, Medplum renders the email and password form inside your own application while the same flow runs underneath. Neither option changes who can access which records, which is controlled by your project, access policies and client configuration.
Choose the embedded login when the sign-in screen must look like part of your product and your team wants full control over layout and wording. Medplum's embedded login documentation describes this as the same authorization code flow with PKCE as the redirect flow, with the form rendered inside your application. Before adopting it, confirm with your security team that your front end can host a credential form under your own content security policy, and that your engineers understand the exposure that comes with it: the password passes through code you ship and operate.
Choose the redirect login when you want the strongest separation between your application and the credentials, or when you want sign-in, password reset and any login-time controls maintained by Medplum rather than by your team. Medplum notes that with the redirect flow, a vulnerability in your app cannot expose credentials it never saw. Confirm the exact callback URLs you need, test the hosted page with your branding limits, and check the Medplum authentication documentation for the current login options before you commit, since sibling topics on MFA and external identity providers depend on which flow you pick.
How the two login options compare
This table compares Medplum's embedded login form with its hosted redirect login across rendering, branding, what your app handles and credential exposure. Read each row against your own app's security review, since the main trade-off is whether your code ever touches the user's password. Both options use the same OAuth2 authorization code flow with PKCE, so the choice is mostly about who owns the sign-in screen and where credentials pass.
| Factor | Embedded login | Redirect login |
|---|---|---|
| Where the form renders | Email and password form inside your own application | Medplum's hosted login page, reached by redirecting the browser |
| Who controls branding | Your team, through your own layout and styling of the form | Medplum-hosted page, with the branding options your deployment exposes (confirm the current scope) |
| What your app handles | The user's email and password pass through your front end before the token exchange | Your app receives only the authorization code and exchanges it for tokens |
| Credential exposure | A vulnerability in your app, such as a script injection or logging bug, could reach the password | A vulnerability in your app cannot expose a password it never received, per Medplum's description |
| Flow standard | OAuth2 authorization code with PKCE, same as redirect | OAuth2 authorization code with PKCE |
| Fits best when | The sign-in screen must match a tightly designed product flow and your team can secure the form | Security review favors minimal credential handling in the application |
| Confirm with your security team | How your app's review treats any component that receives passwords, including logging, analytics and third-party scripts | Whether the redirect round trip and hosted page meet your session and user experience requirements |
| Confirm in your environment | Content Security Policy, dependency controls and monitoring on the sign-in page | Custom domain, hosting and page customization options for your deployment version |
How the shared authorization code with PKCE flow works in both modes
Both modes run the same OAuth2 authorization code flow with PKCE. Whether the email and password form appears inside your application or on Medplum's hosted login page, your app generates a code verifier and code challenge, receives an authorization code and exchanges it for tokens. Medplum issues those tokens the same way in either case, so the downstream API calls, access policies and token handling your app builds do not change based on which login screen the user saw. The decision is about where the credential entry happens, not about how the session is granted.
What changes is the path the user travels. In the redirect flow, the browser leaves your application, the user signs in on Medplum's hosted page, and Medplum sends the browser back to your registered redirect URI with the authorization code. In the embedded flow, the form renders inside your app, so your front end handles the sign-in step and the callback still completes the code exchange. Your team needs to confirm the exact redirect URIs, callback routes and post-login navigation for each mode in the Medplum project, and to test that a failed login, a cancelled sign-in and an expired session all return the user to a sensible state. Session handling also differs in practice: with a redirect, your app typically holds only the returned tokens, while an embedded form means your own pages see the password field before any token exists. Review how your front end stores tokens and clears them on logout, since that code runs in both modes.
Where the credential form sits in each login flow
The flow starts when the user opens sign-in in your application. On the embedded path, the email and password form renders inside your app and submits credentials to Medplum Auth. On the redirect path, your app sends the user to Medplum's hosted login page, where the credentials are entered. Both paths end the same way: Medplum Auth returns an authorization code to your app, which sends it with the PKCE verifier to the token endpoint. Check which side of the trust boundary the password field sits on, because on the embedded path your app's code runs alongside the credentials.
Embedded and redirect paths converge on the same code exchange at the token endpoint.
What the redirect flow keeps out of your application
Medplum's note on the redirect flow is that a vulnerability in your app cannot expose credentials it never saw. That protection is real but bounded: your application still receives tokens, stores session state and calls APIs after sign-in, and those parts need their own review.
Credentials never enter your code
With the redirect flow, the user types the email and password on Medplum's hosted login page, so your front end, its bundles, its logs and its error handlers never receive the password. A security review should confirm that no code path in your app collects, proxies or echoes the password, including analytics snippets and error reporting that capture form fields. Ask the team to show the sign-in route in the browser network trace to verify that only the authorization request leaves your domain.
Embedded login docsAuthorization code and PKCE handling
Your app still generates the PKCE code verifier, sends the authorization request and exchanges the returned code for tokens. Review where the verifier is stored between the redirect and the token call, confirm the state parameter is generated and checked on return, and confirm that the redirect URI registered on the client matches the callback exactly. A missing state check is an application defect that the hosted page cannot prevent.
Token storage in the browser
Once tokens arrive, the app holds an access token and may hold a refresh token. Check whether tokens live in memory, in session storage or in cookies, and whether any script on the page can read them. Confirm that refresh tokens are not placed in local storage in a way that survives browser sessions unless that is a deliberate decision. Token lifetimes should be confirmed with your Medplum administrator for the specific client.
Backend session and token forwarding
If your server holds tokens on behalf of users or forwards them to Medplum, the backend becomes a credential store. Review how sessions are issued, how long they last, how logout revokes them, and whether backend logs record Authorization headers. Illustrative example: a reverse proxy that logs full request headers would store bearer tokens in plain text even though the login page never saw the password.
Third-party scripts and content security
Any script that runs in the sign-in context can read the page, and that includes tag managers, chat widgets and session replay tools. The redirect flow moves the password form off your domain, so the sign-in page itself carries less exposure, but scripts on your authenticated pages still see tokens and data. Confirm a content security policy is applied, that third-party scripts are inventoried, and that session replay tools mask input and authenticated content.
Logout and session end checks
Ending a session must clear tokens in the browser and on any backend, and it should not rely only on the local app state. Test logout from every entry point, confirm that a revoked session cannot call APIs with a cached token, and check how an idle user is handled. Document the expected behavior so the security review can compare it with the observed result.
How to set up embedded or redirect login in Medplum
This sequence takes you from a ClientApplication to a verified sign-in in which your app receives tokens, with the login mode chosen deliberately and checked at each stage.
Create or confirm the ClientApplication
Your Medplum administrator creates a ClientApplication for the app that will sign users in, or confirms that an existing one is correct for this purpose. Record its client ID and the project it belongs to, and confirm that the access policy assigned to it grants only what this app needs. Do this before touching any redirect or login code, because every later check refers to this client. The step is done when you can show the client ID, project and access policy in the Medplum admin console and a colleague can reproduce them from your notes.
Register exact redirect URIs
Add each callback URL your app uses to the ClientApplication's redirect URI list, copying the scheme, host, port, path and trailing slash exactly as your code will send them. Include separate entries for each environment, such as local development, staging and production, rather than reusing one entry for all of them. Test the mismatch case on purpose by sending a sign-in request with a near-identical URL and confirming it is refused. The step is done when the correct callback completes and the altered one fails.
Choose the login mode
Decide between the embedded form, which renders the email and password fields inside your application, and the hosted redirect, which sends users to Medplum's login page and returns them with a code. Both use the same OAuth2 authorization code flow with PKCE, so the choice affects where credentials are typed, how much visual control you have and how much of the sign-in surface your team must secure. Record the decision with the reason, since the security review of your app will ask for it. The step is done when the chosen mode is written down and the team agrees which pages will handle passwords.
Configure the PKCE code challenge
In your client, generate a high-entropy code verifier for each sign-in attempt, derive the code challenge from it using the method your Medplum version and client library support, and send the challenge with the authorization request. Store the verifier only for the duration of that attempt and send it with the token request so the server can match the two. Confirm in the request logs that the authorization call carries a code challenge and that the token call carries the matching verifier. The step is done when a sign-in attempt with a missing or wrong verifier is rejected.
Test sign-in and the callback
Run a sign-in in each environment and follow the redirect or form submission through to your callback. Check that the authorization code arrives at the registered URI, that no password or token appears in your app's URL, logs or browser storage beyond what your design allows, and that the state parameter is validated on return. Use a test user with a non-production role. The step is done when the callback completes on every registered environment and the only values in the URL are the expected code and state.
Confirm token retrieval end to end
Exchange the code for tokens at the token endpoint and confirm that an access token is issued and that a call to a protected FHIR resource with that token returns data permitted by the access policy. Check that a request without a token, or with a token from another client, is refused. Record which token lifetimes apply to this client so your session behavior matches them. The step is done when tokens are issued after sign-in, the protected call succeeds for an allowed resource and fails for a forbidden one.
Review the credential exposure before release
Confirm with your security team which pages render the password field in each mode, and whether your app code, monitoring tools, error reporters or session replay could capture input on those pages. If you chose the embedded form, scope the review to your app's front end and its dependencies, since a vulnerability there sits on the path to the credentials. If you chose the hosted redirect, scope it to your callback handling. Confirm the result with a written sign-off. The step is done when the review record names the exposure points and the mitigations for each.
Security and operational considerations for each login mode
Embedded and redirect login both end in the same authorization code flow, so the differences sit in where the password is typed, how the browser holds tokens and what your team can see when sign-ins go wrong. The cards below are the checks to run before choosing a mode and again after launch.
Where the password is typed
In embedded login, the email and password fields live inside your application, so your front-end code, its dependencies and any script that runs on the sign-in page can read what the user types. In redirect login, the user enters credentials on Medplum's hosted page and your app never receives them. Review every script loaded on the sign-in screen, pin third-party dependencies and treat that page as a high-value target in your own security testing.
Embedded login docsContent Security Policy for embedded forms
An embedded form still has to submit to Medplum's authentication endpoints, so your Content Security Policy must allow the connections and frame or script sources the form needs and nothing broader. Ask your team to write the exact allow-list from the network calls observed during a sign-in, then confirm that the policy blocks injected scripts. Keep the policy identical across staging and production so a sign-in failure does not push someone to loosen it.
Cross-origin settings and CORS
Embedded login makes browser requests from your origin to Medplum, so cross-origin resource sharing and cookie settings determine whether the flow works and which origins can call the auth endpoints. Confirm with Medplum which origins are permitted for your ClientApplication, and avoid wildcard origins. Test sign-in from each domain and subdomain your users reach, because a missing origin often shows up as a silent failure rather than a clear error.
Session and token storage in the browser
Whichever mode you choose, the access and refresh tokens end up in the browser, where scripts running on your origin can reach them. Decide where tokens are kept, how long a session stays idle before it ends and how logout clears both tokens. Confirm the default token lifetimes and any per-client overrides with Medplum before setting your idle timeout, and document the logout path so a shared workstation does not keep a session open.
Redirect URI hygiene
Redirect login depends on exact redirect URIs registered for the client, and loose entries let an attacker send an authorization code somewhere else. List each callback URL precisely, with no wildcards, separate entries for staging and production, and no leftover test hosts. Review the list whenever a domain changes or a preview environment is retired, and confirm the registered values match your application's code exactly.
Medplum auth docsMFA for password logins and SSO
Medplum's multi-factor authentication applies to logins that use a Medplum password, so it covers embedded and redirect password sign-ins equally. Users who sign in through an external or domain-level identity provider receive MFA from that provider, which means your identity provider policy decides their second factor. Map each user group to its sign-in path and confirm with your identity team that no group reaches Medplum through a path without the second factor you expect.
Logging sign-in events
Your team needs records of failed sign-ins, password resets, MFA challenges and token requests to investigate account takeover. Decide which events your deployment records, where they are stored, who can read them and how long they are retained, and confirm each with the Medplum documentation for your version before relying on it. Embedded forms can also generate client-side errors that never reach the server, so log those in your own application as well.
Questions teams ask before choosing a login mode
Does embedded login cost more than redirect login?
Not directly. Medplum uses the same OAuth2 Authorization Code flow with PKCE for both modes, so the login mode does not change the license terms or the sign-in mechanics on Medplum's side. The cost differences come from the surrounding work. Your team builds and maintains a sign-in form, handles error states and password flows in your own UI, and takes on a larger security review scope because your application now renders the credential fields. Medplum's pricing depends on the hosting plan you choose, such as the free, Production, Premium or Enterprise tiers listed on its pricing page, and self-hosting is a separate choice with its own costs. Ask any partner for a quote that separates the hosting plan, the build work and the security testing.
How much effort does switching from redirect to embedded login take?
The effort depends on how much of your sign-in experience already exists. A redirect app usually hands the user to Medplum's hosted page and receives tokens on a callback. An embedded app needs a form that posts the email and password to the token flow, plus handling for password reset, MFA prompts, lockout messages and failed attempts. Medplum's MFA and SSO behavior also needs to be checked for each path, since MFA applies to password logins and SSO users receive MFA from their identity provider. Treat the switch as a scoped change with a list of screens, states and flows, and ask for that list before agreeing on a timeline.
What does the work need from our internal team?
Most teams need four groups of people involved: application engineers who own the login screens and token handling, a security reviewer who understands OAuth2 and PKCE, a product owner who signs off on error messages and branding, and an operations contact who manages the ClientApplication settings and redirect URIs. Your team also needs to decide who owns the Medplum project configuration, since access policies and the client registration affect every app that signs in. Confirm these owners early so the work does not stall waiting for a decision.
Can our own engineers build embedded login without a partner?
Yes, if your engineers have current experience with OAuth2 Authorization Code flow, PKCE, secure token storage and front-end form security. The harder part is rarely the form itself. It is the surrounding work: handling every error path, keeping the credential fields out of logs and analytics, configuring the Content Security Policy, and proving to a security reviewer that the app cannot leak what it collects. Many teams keep the build in-house and bring in outside testing for the final review. Be honest about your team's OAuth2 depth before deciding.
How long does validation take before we go live?
Validation time depends on the size of the login surface, the number of user populations (staff, patients, external partners) and how many identity paths you support. Plan separate test passes for successful logins, failed logins, lockout, password reset, MFA enrollment, token refresh and logout. Also test with the access policies your real users hold, not only with admin accounts. Ask for a written test plan with entry and exit criteria, and do not accept a duration until that plan exists. Medplum's own token lifetime settings affect the idle session tests, so include those too.
How does the choice affect our security review?
Redirect login keeps the credential form on Medplum's hosted page, so your application never receives the password. Medplum describes this as a benefit: a vulnerability in your app cannot expose credentials it never saw. Embedded login moves that credential handling into your code, which brings the form, its scripts, its logging and its dependencies into the review scope. Expect reviewers to ask about cross-site scripting defenses, third-party scripts, autofill behavior, error message wording and how tokens are stored after sign-in. Your compliance team should also map the change to the controls that cover authentication in your program, since a shared responsibility model applies to Medplum deployments.
Does DeployOpen handle the login build and the security testing?
DeployOpen implements and customizes self-hosted open-source platforms in the client's own infrastructure, and runs security testing of applications and APIs. For a Medplum login change, the work can include planning the flow, configuring the ClientApplication and redirect URIs, building or reviewing the sign-in form, and testing the result against the threats a reviewer will raise. Most engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts. DeployOpen does not issue audit reports or certifications, so any compliance evidence still comes from your independent auditor.
Where can we confirm the current login options in Medplum?
Start with Medplum's embedded login documentation, which describes the shared flow and the credential exposure trade-off. Then check Medplum's authentication documentation for the identity provider and MFA options that apply to your plan and deployment. Because Medplum releases change often, confirm the behavior against the version you run, using the release notes on the GitHub releases page. Put your confirmed settings in writing before you start the build.
Limits to confirm before you commit to a login mode
Embedded login and redirect login both run the same authorization code flow with PKCE, so the choice mostly comes down to where the credential form lives and who has to approve that. The cards below are questions to settle with Medplum and your own compliance and engineering teams before you commit to one mode.
Hosting plan and login options
Confirm whether your hosting choice changes which login modes you can use. Ask Medplum whether embedded login is available on Medplum Cloud plans and on a self-hosted deployment, and whether any login feature depends on a paid tier. The pricing page lists identity provider features under enterprise plans, so check which login features sit in that tier. Get the answer in writing before the design review.
Medplum pricingBranding customization limits
Ask what you can change on the hosted login page and what you can change inside an embedded form. Typical questions cover logo, colors, custom text, custom domains, and whether the form can match your app's layout and accessibility standards. If branding is a hard requirement, confirm it on the exact plan and version you will run, because limits can differ between hosted and self-hosted builds.
Supported browsers for embedded forms
Ask Medplum for the browser and device matrix that the embedded sign-in form supports, and confirm it against the browsers your clinicians and patients use, including managed or older browsers. Test the form inside your own app shell, since content security policies, iframe or script restrictions and cookie settings can break it even when the standalone page works.
Credential handling sign-off
With embedded login, your application's front end receives the email and password, which brings that code into your scope for review. With redirect login, Medplum's documentation says a vulnerability in your app cannot expose credentials it never saw. Ask your compliance and security teams whether they accept your chosen handling, including logging, error reporting, analytics scripts and third-party components on the login screen.
Embedded login docsSession and token behavior per mode
Confirm that token lifetimes, refresh behavior and logout are identical in both modes for your application. Ask Medplum whether any setting differs when the form is embedded, and test idle timeout and sign-out in your own app to see whether the session ends where your policy requires it.
How DeployOpen scopes and delivers Medplum login work
DeployOpen approaches Medplum embedded login versus redirect login as a scoped piece of identity work inside infrastructure you control. We define which login model fits your applications, configure the authorization code flow with PKCE, and test the sign-in surface before handover, so your security and compliance teams can review the result.
How we scope
- Engagements are fixed-scope, with the login model, client applications and redirect settings agreed in writing before work starts.
- Scope lists which apps will use the hosted login page and which will render an embedded sign-in form, with the reasons for each.
- We document the credential exposure trade-off for each application so your security review has a clear decision record.
- Scope states who owns branding assets, test accounts and the identity provider configuration on your side.
How we build
- We configure the ClientApplication, exact redirect URIs and PKCE settings for each client in your Medplum project.
- Embedded login forms are built into your application with error handling, session handling and no credential storage in your code.
- Hosted login branding is set up to match your approved styling, with changes tracked in version control.
- We test the sign-in flow end to end, including failed logins, redirect mismatches and token handling in each client.
How we hand over
- You receive a written record of the chosen login model per application, with configuration values and their owners.
- Runbooks cover adding a new client, changing a redirect URI and rotating the settings your team controls.
- Test results and findings are delivered with fixes applied or tracked, and a retest confirms the closed items.
- Knowledge transfer sessions walk your engineers through the flow so they can maintain it after handover.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers for Medplum deployments you run.
- Retainers can cover re-testing the login surface after Medplum upgrades, so changes to the auth flow are checked before release.
- Support can include reviewing new applications before they receive a login form or a redirect client.
- Ask in your quote which upgrade and retest activities the retainer includes and how requests are prioritized.

