Skip to content

feat(embedded): add signup support for email and phone identifer - #1123

Merged
pmathew92 merged 5 commits into
v5_developmentfrom
feat/embedded_signup
Nov 5, 2026
Merged

pmathew92 merged 5 commits into
v5_developmentfrom
feat/embedded_signup

Conversation

@pmathew92

@pmathew92 pmathew92 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Changes

Adds embedded signup to the /e/authorize flow: a new user creates a passwordless account by verifying an email address or phone number with a one-time code.

Public API added

  • EmbeddedAuthClient.signup(): Request<Void?, EmbeddedAuthException> starts signup (action:signup:v1). It always continues with the identify step.
  • EmbeddedAuthClient.confirmSignup(): Request<Credentials, EmbeddedAuthException> creates the account (action:signup:confirm:v1). It is terminal: it exchanges the code and returns Credentials, or continues with MFA if the tenant requires it.
  • EmbeddedCapability.SIGNUP and EmbeddedCapability.CONFIRM_SIGNUP are added to DEFAULT_CAPABILITIES.
  • NextAction.Signup(identifiers: List<SignupIdentifier>) and NextAction.ConfirmSignup.
  • SignupIdentifier(type: IdentifierType, required: Boolean) is read from the OAS identifiers object (email, phone_number). Identifier keys the SDK doesn't model are ignored. A Signup action is dropped if identifiers is missing or empty, or if an entry has no required flag.

Errors. No new error types. Signup errors map to existing ones:

Testing

  • This change adds unit test coverage

  • This change adds integration test coverage

  • This change has been tested on the latest version of the platform/language or why not

Checklist

@pmathew92
pmathew92 requested a review from a team as a code owner November 4, 2026 09:56
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Team
  • Run ID: d7a1a72d-798f-4208-8ab9-b10b69010909

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

@pmathew92 pmathew92 changed the title feat(embedded): add signup and confirmSignup steps feat(embedded): add embedded signup for email and phone Nov 4, 2026
@pmathew92 pmathew92 changed the title feat(embedded): add embedded signup for email and phone feat(embedded): add signup support for email and phone identifer Nov 4, 2026
return identifiers.ifEmpty { null }
}

private val SIGNUP_IDENTIFIER_TYPES: List<Pair<String, IdentifierType>> = listOf(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The design doc lists IdentifierType(Email | Phone | Username) for signup, but the mapper only reads email and phone_number.Is username signup out of scope?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. User name support is not added at the moment and will be added in the alter phase

}

@Test
public fun `authorize continuation ignores signup identifiers the SDK does not model`(): Unit = runTest {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignores signup identifiers the SDK does not model uses username as its example, but the SDK does model USERNAME. Please use a made-up key (for example foo) and add a separate test for username.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is added with the idea that we only support email | phone for the current release. I will remove username from the identifier type to avoid confusion

private fun Map<*, *>.toSignupIdentifiers(): List<SignupIdentifier>? {
val identifiers = SIGNUP_IDENTIFIER_TYPES.mapNotNull { (key, type) ->
if (!containsKey(key)) return@mapNotNull null
val required = (this[key] as? Map<*, *>)?.get(REQUIRED_KEY) as? Boolean ?: return null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any identifier is missing required, return null drops the entire Signup action, so the user loses the signup option completely. is it intended here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed to drop only the malformed types


// 1. Start the flow. When the connection allows sign-ups, the next actions include NextAction.Signup.
try {
embedded.authorize("Username-Password-Authentication").await()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a passwordless email/phone OTP signup, but the sample connection is Username-Password-Authentication. Please use the connection type this flow actually needs, or add a line explaining which connection setup is required.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is passwordless for DB connection. this is correct

Comment thread examples/embedded-auth/signup.md Outdated
} catch (e: EmbeddedAuthException) {
when (val error = e.error) {
is EmbeddedAuthError.InsufficientAuthorization -> {
if (error.reason == EmbeddedAuthError.InsufficientAuthorization.Reason.INVALID_IDENTIFIER_OR_CODE) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example only checks INVALID_IDENTIFIER_OR_CODE. A wrong code can also come back as INVALID_CODE, so please handle both, as authorize.md does.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the check for INVALID_CODE too

assertThat(error.code, `is`("no_active_session"))
}

// ── signup / confirmSignup ──────────────────────────────────────────────────

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the new tests use await(). Please add at least one start(callback) test for confirmSignup, covering success and failure. The callback path in AdvancingRequest is a separate code path.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally skipped callback one. await() internally uses the callback APIs . Its just duplicating tests with no actual benefit

@pmathew92
pmathew92 merged commit 43da1d8 into v5_development Nov 5, 2026
7 checks passed
@pmathew92
pmathew92 deleted the feat/embedded_signup branch November 5, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants