Documentation
Feedback
Guides
VTEX IO Apps

VTEX IO Apps
Login with Alternative Key
Official extension
Version: 1.11.1
Latest version: 1.11.1

Render IO app that replaces vtex.login to support the alternative login with username method (a temporary B2B solution created for the ODP project).

Configuration

  1. Add the Login app to your theme's dependencies in the manifest.json file:

_10
"dependencies": {
_10
+ "vtex.login-alternative-key": "1.x"
_10
}

Now, you are able to use all the blocks exported by the Login with Alternative Key app. Check out the full list below:

Block nameDescription
loginOnly renders a "Login" button that redirects to the login page.
login-content
{"base64":"  ","img":{"width":69,"height":20,"type":"svg","mime":"image/svg+xml","wUnits":"px","hUnits":"px","url":"https://img.shields.io/badge/-Mandatory-red"}}
Renders the complete login form.
  1. Add the vtex.login-alternative-key app to your custom store theme dependencies:

manifest.json


_10
"dependencies": {
_10
"vtex.store": "2.x",
_10
"vtex.login-alternative-key": "1.x",
_10
}

If you used the vtex.store-theme template, remove the vtex.login dependency.


_10
+ "vtex.login-alternative-key": "1.x",
_10
- "vtex.login": "2.x",

  1. Add the login-content block to your custom store theme's login page. It must implement the store.login interface from vtex.store:

blocks.json


_10
"store.login": {
_10
"blocks": [
_10
"login-content"
_10
]
_10
},

Ensure the store.login implementation is only declared once. If you used the vtex.store-theme template, remove the login-content#default block and its props.


_10
+ "blocks": ["login-content"]
_10
- "blocks": ["login-content#default"]


_10
- "login-content#default": {
_10
- "props": {
_10
- "isInitialScreenOptionOnly": false,
_10
- "defaultOption": 1,
_10
- "showPasswordVerificationIntoTooltip": true
_10
- }
_10
- },

  1. Optionally, add the login block to your store's header. For example:

_10
"flex-layout.row#4-desktop": {
_10
"children": [
_10
"login"
_10
]
_10
},

Modus Operandi

The Login with Alternative Key app reads the following query-string parameters:

  • returnUrl - Redirects users to the given returnUrl once they are logged in. Caution: This parameter only works for the store's domain and should be UTF-8 encoded (as in javascript's encodeURIComponent).

Customization

In order to apply CSS customizations in this and other blocks, follow the instructions given in the recipe on Using CSS Handles for store customization.

CSS Handles
loginContainer
userIdentificationContainer
userIdentificationTitle
userIdentificationForm
userIdentificationInput
userIdentificationOptions
userIdentificationSignUp
userIdentificationContinueButton
passwordLoginContainer
passwordLoginTitle
passwordLoginForm
passwordLoginInputs
passwordLoginError
passwordLoginOptions
passwordLoginButtons
passwordLoginSignUp
passwordLoginBackButton
passwordLoginSignInButton
passwordCreationContainer
passwordCreationTexts
passwordCreationTitle
passwordCreationDescription
passwordCreationForm
passwordCreationInputs
passwordCreationInputPassword
passwordCreationOptions
passwordCreationBackButton
passwordCreationSignInButton
passwordCreationPasswordRequirementsContainer
passwordCreationPasswordRequirementsTitle
passwordCreationPasswordRequirementsList
passwordCreationPasswordRequirementsItem
passwordCreationError

How to run the project

After logging into a test account and using a custom workspace, to see the changes made to that app, we need to link it with the command:

vtex link

However, since this app is not included in the default store theme, you'll need to modify an additional app to test these changes.

Edit the store-theme app

  1. Clone the app from this repository

  2. Edit the blocks.jsonc file:


_10
+ "blocks": ["login-content"]
_10
- "blocks": ["login-content#default"]


_10
- "login-content#default": {
_10
- "props": {
_10
- "isInitialScreenOptionOnly": false,
_10
- "defaultOption": 1,
_10
- "showPasswordVerificationIntoTooltip": true
_10
- }
_10
- },

  1. Edit the manifest.json file:

_10
+ "vtex.login-alternative-key": "1.x",
_10
- "vtex.login": "2.x",

  1. Link the app

vtex link

You just need to link that once per workspace, so you don't need to keep this linked while making your changes to the login-alternative-key app.

See also
VTEX App Store
VTEX IO Apps
ADR
VTEX IO Apps
Was this helpful?