Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

Commit ad56d00

Browse files
Merge pull request #623 from storyblok/hotfix/2fa
fix: give error if 2FA is not successful
2 parents fa740aa + 5d80bc4 commit ad56d00

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/utils/api.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ module.exports = {
3535
const { data } = response
3636

3737
if (data.otp_required) {
38+
// code sending to phone is currently not triggered in the CLI
3839
const questions = [
3940
{
4041
type: 'input',
4142
name: 'otp_attempt',
42-
message: 'We sent a code to your email/phone, please insert the authentication code:',
43+
message: 'We sent a code to your email, please insert the authentication code:',
4344
validate (value) {
4445
if (value.length > 0) {
4546
return true
@@ -69,10 +70,13 @@ module.exports = {
6970

7071
persistCredentials (email, data) {
7172
const token = this.extractToken(data)
72-
this.accessToken = token
73-
creds.set(email, token)
73+
if (token) {
74+
this.accessToken = token
75+
creds.set(email, token)
7476

75-
return Promise.resolve(data)
77+
return Promise.resolve(data)
78+
}
79+
return Promise.reject(new Error('The code could not be authenticated.'))
7680
},
7781

7882
async processLogin () {

0 commit comments

Comments
 (0)