hi this is my angluar code written for login throu...
# ask-a-descoper
a
hi this is my angluar code written for login through bring your own screen
Copy code
onLoginFormSubmit(event: Event): void {
    event.preventDefault();

    if (this.flowConfigInvalid()) {
      return;
    }

    if (!this.nextFn) {
      this.snackbarService.showError('Authentication flow not initialized.');
      return;
    }

    if (this.loginForm.invalid) {
      this.loginForm.markAllAsTouched();
      return;
    }

    this.loginCompleted.set(false);
    this.isLoading.set(true);
    this.exchangeInProgress.set(true);
    this.loaderService.show();

    const { email, password } = this.loginForm.getRawValue();

    this.loginByosFlowOrchestrator
      .submitCredentialsAndExchange$({
        nextFn: this.nextFn,
        interactionId: this.loginFlowInteractionId,
        email,
        password,
      })
      .pipe(
        tap(() => {
          this.loginCompleted.set(true);
          void this.router.navigate([ROUTES.DASHBOARD]);
        }),
        catchError((err: unknown) => {
          this.snackbarService.showError(this.resolveLoginErrorMessage(err));
          return EMPTY;
        }),
        finalize(() => {
          this.isLoading.set(false);
          this.exchangeInProgress.set(false);
          this.loaderService.hide();
        }),
        takeUntilDestroyed(this.destroyRef),
      )
      .subscribe();
  }
this is showing error as Did not find next task Could not get next task for [Login] Error for this api when called
Copy code
Request URL
<https://api.descope.com/v1/flow/next>
Request Method
POST
Status Code
400 Bad Request
Remote Address
104.18.27.223:443
Referrer Policy
strict-origin-when-cross-origin
payload is sent as
Copy code
{
  "executionId": "direct-signup-signin-flow-dev|#|3BM0cr4NfHNmB2Yo9RebQs4KYe1",
  "stepId": "1",
  "interactionId": "AMeyg_7npFqa",
  "version": 1,
  "componentsVersion": "3.0.2",
  "input": {
    "email": "<mailto:aksha+8030@signitysolutions.com|aksha+8030@signitysolutions.com>",
    "password": "Test@123"
  }
}
response
Copy code
{
  "errorCode": "E102103",
  "errorDescription": "Did not find next task",
  "errorMessage": "Could not get next task for [Login]",
  "message": "Could not get next task for [Login]"
}
can you please help understand what could be the issue here in the function written
✅ 1
d
Flow Configuration Issue The E102103 error "Did not find next task" indicates your flow configuration doesn't match the API request parameters. The issue is likely with the
stepId
or flow structure. Check Flow Configuration 1. Verify your flow has a Login screen with the correct step ID 2. In the Descope console, check your flow's Login screen step ID - it might not be "1" 3. Ensure the Login screen has the expected interaction ID "AMeyg_7npFqa"
Copy code
// Debug by logging the flow response before calling next
console.log('Flow execution details:', {
  executionId: this.loginFlowInteractionId,
  stepId: '1', // Verify this matches your flow
  interactionId: this.nextFn?.interactionId
});
Verify BYOS Setup The error suggests a mismatch between your flow configuration and the API call. Check that: • Your flow's Login screen step ID matches the
stepId
in the payload • The interaction ID from
onScreenUpdate
callback matches what you're sending • The screen expects
email
and
password
inputs as configured Bring Your Own Screen | Descope Documentation
a
this seems fine
d
Root Cause The E102103 error occurs when flow steps aren't properly connected. The documentation confirms this means "the next flow step was not found" and to "ensure that the steps are connected throughout the flow and all the way to the end step" . Debug Steps 1. Check your flow in the Descope console - verify the Login screen connects to the next step 2. Ensure there's a path from Login to an End action 3. Verify the Login screen's success interaction connects to another step
Copy code
// Add this before your API call to debug the flow state
console.log('Current flow state:', {
  executionId: this.loginFlowInteractionId,
  nextFn: this.nextFn,
  interactionId: this.nextFn?.interactionId
});
Common Fixes • Connect your Login screen's success button to the next flow step • Add an End action if the flow terminates after login • Check that conditional logic doesn't create dead ends in your flow The issue is likely in your flow builder configuration, not your Angular code. Descope Common Errors | Descope Documentation
a
this is the export of my flow
d
I can see you've uploaded your flow export file, but I'm unable to access the file contents directly. However, I can help you analyze the flow structure to identify the connection issue causing the E102103 error. Analyze Your Flow Export To debug the "Did not find next task" error, check these key areas in your exported flow JSON: 1. Find your Login screen - look for the screen with
stepId: "1"
2. Check the interactions - verify the success interaction ID matches what you're sending 3. Trace the connections - ensure the Login screen connects to another step Key Things to Look For
Copy code
// In your flow export, find:
{
  "screens": [
    {
      "stepId": "1",  // This should match your API call
      "interactions": [
        {
          "id": "AMeyg_7npFqa",  // Should match your interactionId
          "nextStepId": "2"      // Must point to valid next step
        }
      ]
    }
  ]
}
Common Issues • Login screen's success interaction doesn't have a
nextStepId
• The
nextStepId
points to a non-existent step • Missing End action if the flow should terminate after login Can you check if your Login screen (stepId "1") has a valid connection to the next step in the exported JSON? The issue is likely that the success interaction isn't properly connected to another flow step . Descope Common Errors | Descope Documentation
a
@Kevin Gao can you please help me here
d
I'll connect you with Kevin Gao from our support team to help analyze your flow export and resolve the E102103 "Did not find next task" error. He'll be able to examine your specific flow configuration and identify the connection issue causing the problem.
a
this is the service used
Copy code
submitCredentialsAndExchange$(input: SubmitCredentialsAndExchangeInput): Observable<void> {
    const { nextFn, interactionId, email, password } = input;

    return from(nextFn(interactionId, { email, password })).pipe(
      switchMap(result => {
        if (result == null) {
          return EMPTY;
        }

        if (!isDescopeNextResultCandidate(result)) {
          return throwError(
            () =>
              new LoginFlowError('UNKNOWN', 'Unexpected response from sign-in.'),
          );
        }

        const descopeResult = result;

        if (isPasswordSignInFailed(descopeResult)) {
          return throwError(
            () =>
              new LoginFlowError(
                'WRONG_PASSWORD',
                getPasswordSignInFailedMessage(descopeResult),
              ),
          );
        }

        const code = sessionStorage.getItem(DIRECT_LOGIN_SESSION_KEYS.CODE)?.trim();
        const codeVerifier = sessionStorage.getItem(AUTH_FLOW_SESSION_KEYS.PKCE_CODE_VERIFIER)?.trim();
        const state = sessionStorage.getItem(DIRECT_LOGIN_SESSION_KEYS.STATE);
        const pkceState = sessionStorage.getItem(AUTH_FLOW_SESSION_KEYS.PKCE_STATE);

        if (!codeVerifier) {
          return throwError(
            () =>
              new LoginFlowError(
                'SESSION_EXPIRED',
                'Session expired. Please sign in again.',
              ),
          );
        }

        // OIDC redirect_uri is /login-exchange-token: auth code arrives there, not on /login.
        // Same-page exchange runs only when code was already stored (e.g. ?code= on /login).
        if (!code) {
          return EMPTY;
        }

        if (state && pkceState && state !== pkceState) {
          return throwError(
            () =>
              new LoginFlowError(
                'SESSION_EXPIRED',
                'Session expired. Please sign in again.',
              ),
          );
        }

        return this.loginByosExchange.exchangeDirectByosSessionToTokens$().pipe(
          catchError((err: unknown) => this.normalizeExchangeError(err)),
        );
      }),
    );
  }
d
Looking at your service code, I can see the issue. The problem is in your flow logic after the
nextFn
call. The Issue Your code expects to find a
code
in sessionStorage after the flow completes, but with BYOS login flows, the code isn't automatically stored there. When
code
is null, your service returns
EMPTY
, which means the observable completes without emitting any value. The Fix The
nextFn
call should complete the flow and provide the tokens directly. You shouldn't need to do a separate token exchange for a basic login flow. Try this simplified version:
Copy code
submitCredentialsAndExchange$(input: SubmitCredentialsAndExchangeInput): Observable<void> {
  const { nextFn, interactionId, email, password } = input;
  return from(nextFn(interactionId, { email, password })).pipe(
    switchMap(result => {
      if (result == null) {
        return EMPTY;
      }
      if (!isDescopeNextResultCandidate(result)) {
        return throwError(
          () => new LoginFlowError('UNKNOWN', 'Unexpected response from sign-in.')
        );
      }
      if (isPasswordSignInFailed(result)) {
        return throwError(
          () => new LoginFlowError(
            'WRONG_PASSWORD', 
            getPasswordSignInFailedMessage(result)
          )
        );
      }
      // For basic login flows, the tokens should be available directly
      // Check if result contains tokens or if flow completed successfully
      return of(undefined); // Success case
    }),
    catchError((err: unknown) => this.normalizeExchangeError(err))
  );
}
Root Cause Your flow is completing successfully, but your service logic is looking for an authorization code that doesn't exist in a direct login scenario. The E102103 error might be a red herring - the real issue is your token exchange logic expecting OIDC flow artifacts that aren't present in BYOS flows.