VTEX Login App
repository·main·Indexed 41 days ago
https://github.com/vtex-apps/loginProvides components and logic to handle user authentication and login flows in a VTEX store. Includes the `login` and `login-content` blocks (version 2.x), support for Google One Tap, and query-string parameters for controlling redirects and OAuth flows.
What's inside VTEX Login
- The VTEX Login app is responsible for managing and handling user authentication and login processes within your VTEX store.
Install the Login app
mainTo use the Login blocks in your theme, add
vtex.loginversion2.xto yourmanifest.jsondependencies.Available blocks:
login: Renders the full Login component (Mandatory).login-content: Renders only the login form.
"dependencies": { "vtex.login": "2.x" }Control Login behavior via query-string parameters
mainYou can customize the behavior of the Login app by appending specific query-string parameters to the URL. This allows you to control redirects, OAuth flows, and the initial state of the login process.
Supported Parameters
Parameter Description returnUrlRedirects users to the specified URL after a successful login. Note: This only works for the store domain and must be UTF-8 encoded (e.g., using encodeURIComponent).oAuthRedirectBypasses the native login options to redirect directly to an OAuth provider. The provider must be enabled in the component. Values are case-sensitive: Google,Facebook, or the specific name of the chosen provider.userEmailProvides the user's email information. flowStateSets the default state of the login flow. Use createPassto trigger an email containing a code for creating a new password. Note: UsingcreatePassrequires theuserEmailparameter to be present in the same URL.Configure the `login` block
mainAdd the
loginblock to your store header and configure its properties. Common props include titles, placeholders, and behavior settings.Example configuration:
"login": { "props": { "emailAndPasswordTitle": "LOG-IN", "accessCodeTitle": "Acess Code LOG-IN", "emailPlaceholder": "e-mail", "passwordPlaceholder": "password", "showPasswordVerificationIntoTooltip": true } }"login": { "props": { "emailAndPasswordTitle": "LOG-IN", "accessCodeTitle": "Acess Code LOG-IN", "emailPlaceholder": "e-mail", "passwordPlaceholder": "password", "showPasswordVerificationIntoTooltip": true, } }Reference: `login` block props
mainThe following properties are available for the
loginblock to customize the component's appearance and behavior.Prop name Type Description Default optionsTitlestringTitle text for login options. undefinedemailAndPasswordTitlestringText for email and password option. undefinedaccessCodeTitlestringText for access code option. undefinedemailPlaceholderstringPlaceholder for email input. undefinedpasswordPlaceholderstringPlaceholder for password input. undefinedacessCodePlaceholderstringPlaceholder for access code input. undefinedshowPasswordVerificationIntoTooltipbooleanShow password format tooltip. trueshowIconProfilebooleanDisplay hpa-profileicon.trueiconLabelstringTitle text for the Login icon. undefinedhideIconLabelbooleanHide the Login icon text. falselabelClasses[string]Login icon classnames. undefinedproviderPasswordButtonLabelstringPassword button label. undefinedhasIdentifierExtensionbooleanEnable identifier extension configurations. trueidentifierPlaceholderstringPlaceholder for the extension input. undefinedinvalidIdentifierErrorstringError message for invalid identifier. undefinedmirrorTooltipToRightbooleanOpen tooltip on the right side. falselogInButtonBehaviorenumpopover(opens popover) orlink(redirects to/login).popoveraccountOptionsButtonBehaviorenumpopover(opens popover) orlink(redirects to/account).popoveraccountOptionLinks[object]Custom link object to replace default /accountbehavior.undefinedtermsAndConditionsstringText displayed below login options. undefinedhasGoogleOneTapbooleanBeta: Enable Google One Tap sign-up/auto sign-in. falsegoogleOneTapAlignmentenumBeta: leftorright.rightgoogleOneTapMarginTopstringBeta: CSS topvalue for pop-up margin.3remdisabledEmailInputsbooleanAllow/disallow user email editing. falseReference: `login-content` block props
mainThe
login-contentblock is used when you only want to render the login form. It supports a subset of theloginblock props.Prop name Type Description Default isInitialScreenOptionOnlybooleanShow only login options on initial screen. truedefaultOptionenum0(access code),1(email/password),2(corporate).0optionsTitlestringTitle text for login options. undefinedemailAndPasswordTitlestringText for email/password option. undefinedaccessCodeTitlestringText for access code option. undefinedemailPlaceholderstringPlaceholder for email input. undefinedpasswordPlaceholderstringPlaceholder for password input. undefinedshowPasswordVerificationIntoTooltipbooleanShow password format tooltip. trueacessCodePlaceholderstringPlaceholder for access code input. undefinedproviderPasswordButtonLabelstringPassword button label. undefinedhasIdentifierExtensionbooleanEnable identifier extension configurations. trueidentifierPlaceholderstringPlaceholder for the extension input. undefinedinvalidIdentifierErrorstringError message for invalid identifier. undefinedtermsAndConditionsstringText displayed below login options. undefineddisabledEmailInputsbooleanAllow/disallow user email editing. falseReference: `accountOptionLinks` object props
mainWhen customizing
accountOptionsButtonBehaviortolink, use this object to define custom links.Prop name Type Description labelstringText label for the custom link. pathstringCustom link path. cssClass[string]Login icon classnames. Customize Login app styles using CSS handles
mainThe Login app supports customization via CSS handles. To apply custom styles, follow the standard VTEX IO recipe for Using CSS handles for store customization.
Below is the complete list of available CSS handles for this app:
`container` `contentInitialScreen` `contentFormVisible` `profile` `label` `optionsSticky` `optionsList` `optionsListItem` `optionsListItemContainer` `accessCodeOptionBtn` `emailPasswordOptionBtn` `corporateOptionBtn` `facebookOptionBtn` `googleOptionBtn` `customOAuthOptionBtn` `oauthProvider` `inputContainer` `inputContainerAccessCode` `inputContainerPassword` `inputContainerEmail` `emailVerification` `emailForm` `emailAndPasswordForm` `forgotPasswordForm` `formLinkContainer` `arrowUp` `buttonLink` `formError` `content` `content--emailVerification` `content--emailAndPassword` `content--codeConfirmation` `content--accountOptions` `content--recoveryPassword` `button` `sendButton` `buttonSocial` `buttonDanger` `backButton` `accountOptions` `codeConfirmation` `corporateEmail` `formTitle` `formSubtitle` `box` `contentContainer` `formFooter` `contentForm` `contentAlwaysWithOptions` `options` `tooltipContainer` `tooltipContainerTop` `tooltipContainerLeft` `loginOptionsContainer` `termsAndConditions` `forgotPasswordLink` `dontHaveAccount` `eyeIcon`