Skip to main content

<SignUp />

You're reading Identity & Access Management 7.0.0. The newest release is 7.3.0, and Cloud has the newest features. Go to the newest release

The SignUp component of the WSO2 Identity Server Vue SDK (@asgardeo/vue) renders a self-registration form inside your app, so users create an account without leaving it.

note

Self-registration must be enabled in your WSO2 Identity Server organization. The component runs the registration flow through the WSO2 Identity Server flow execution API (/api/server/v1/flow/execute).

Overview​

When it mounts, SignUp starts a registration flow with WSO2 Identity Server and renders the fields and steps that the flow returns. It validates the input, submits each step and shows the errors that WSO2 Identity Server returns.

To identify your application, SignUp sends the applicationId set on <AsgardeoProvider>, or the applicationId query parameter of the current URL.

When the flow completes, SignUp calls onComplete. Then, unless you set should-redirect-after-sign-up to false, it redirects the browser to the redirect URL returned by the flow, or to afterSignUpUrl if you set it.

Usage​

The following examples show how to use SignUp.

Basic usage​

Render SignUp on your registration page, for example a /signup route.

SignUp example
<script setup>
import { SignUp } from '@asgardeo/vue'
</script>

<template>
<SignUp after-sign-up-url="/welcome" />
</template>

To send users to this page from <SignUpButton>, set sign-up-url on <AsgardeoProvider> to the page's URL.

Handling completion and errors​

SignUp with callbacks
<script setup>
import { SignUp } from '@asgardeo/vue'

const onComplete = (response) => {
console.log('Registration complete', response)
}

const onError = (error) => {
console.error('Registration failed:', error)
}
</script>

<template>
<SignUp
:should-redirect-after-sign-up="false"
:on-complete="onComplete"
:on-error="onError"
/>
</template>

Props​

PropTypeRequiredDescription
afterSignUpUrlstring❌Where to redirect the user after sign-up when the flow doesn't return a redirect URL.
shouldRedirectAfterSignUpboolean❌Whether to redirect after the flow completes. Defaults to true.
onComplete(response: EmbeddedFlowExecuteResponse) => void❌Called when the registration flow completes.
onError(error: Error) => void❌Called when the flow fails.
showTitleboolean❌Whether to show the title. Defaults to true.
showSubtitleboolean❌Whether to show the subtitle. Defaults to true.
size'small', 'medium' or 'large'❌Size of the form. Defaults to 'medium'.
variant'elevated', 'outlined' or 'flat'❌Style of the card that wraps the form. Defaults to 'outlined'.
classNamestring❌CSS class to add to the component.
buttonClassNamestring❌CSS class to add to the buttons.
inputClassNamestring❌CSS class to add to the inputs.
errorClassNamestring❌CSS class to add to error messages.
messageClassNamestring❌CSS class to add to flow messages.

Slots​

SlotSlot propsDescription
defaultSee belowReplaces the built-in form with your own UI.

The default slot receives the state of the flow and the functions to drive it:

Slot propTypeDescription
titlestringTitle of the current step.
subtitlestringSubtitle of the current step.
componentsany[]The components (fields, buttons, text) of the current step, as returned by WSO2 Identity Server.
valuesRecord<string, string>Current values of the fields.
errorsRecord<string, string>Validation errors, by field name.
touchedRecord<string, boolean>Fields that the user has changed, by field name.
isValidbooleanWhether the current values are valid.
isLoadingbooleanWhether a request is in progress.
messages{ message: string; type: string }[]Messages returned by the flow.
handleInputChange(name: string, value: string) => voidUpdates the value of a field.
handleSubmit(component: any, data?: Record<string, any>) => Promise<void>Submits the step using the given action component.

Was this page helpful?