Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • dev-thandabantu 41 posts 321 karma points
    Nov 09, 2022 @ 09:26
    dev-thandabantu
    0

    Include redirection to Azure AD B2C in the custom workflow of an Umbraco Form

    I have a form that looks like this: Form

    I want to have a custom workflow that does the following steps:

    1. Check against my database if entered Entity Name is valid
    2. If valid, redirect user to Azure AD B2C for registration/signup
    3. Collect info entered on my Umbraco Form and info from the Azure AD B2C and send to database.

    Here is what I have tried in my custom workflow:

    public override WorkflowExecutionStatus Execute(WorkflowExecutionContext context)
    {
       try
       {
          if(EntityNameExists)
          {
             //TODO: redirect to Azure AD B2C
    
             //TODO: Send data from BOTH umbraco and Azure AD B2C
          }
       }
       catch (Exception)
       {
              return WorkflowExecutionStatus.Failed;
       }
       return WorkflowExecutionStatus.Completed;
    }
    

    I have completed the set up (userflow) on Azure. I am not sure what's the best way to accomplish what I want. Please help.

  • dev-thandabantu 41 posts 321 karma points
    Nov 09, 2022 @ 09:50
    dev-thandabantu
    0

    I have also tried splitting the above workflow into three different (and smaller) workflows as follows:

    1. Check Entity Code workflow
    2. Redirect to Azure AD B2C workflow
    3. Collect data from Umbraco form and user details (registered via Azure) and send to my database

    Visually that looks like this:

    Workflow visualizations

    My "Azure" workflow looks like below:

    public override WorkflowExecutionStatus Execute(WorkflowExecutionContext context)
    {
            try
            {
                _httpContextAccessor.HttpContext.Items[Constants.ItemKeys.RedirectAfterFormSubmitUrl] = @"https://www.umbraco.com";
                return WorkflowExecutionStatus.Completed;
            }
            catch (Exception)
            {
                return WorkflowExecutionStatus.Failed;
            }
     }
    

    And the redirect works (to our.umbraco.com). But it doesn't look like the last workflow (Send details to Database) 'waits' (if that even makes sense) for the 2nd workflow to complete so that the 3rd workflow can access the user details that comes after successful registration on Azure AD B2C.

    What do I do? How should I implement this flow?

  • dev-thandabantu 41 posts 321 karma points
    Nov 09, 2022 @ 20:42
    dev-thandabantu
    0

    Anyone with some ideas?

  • Mehmet Avcı 55 posts 240 karma points
    Nov 11, 2022 @ 15:09
    Mehmet Avcı
    0

    Hi there,

    I believe you have been trying to mash up several things together.

    Let's separate these. First, you have your form in which you get some information. Redirection to Azure AD should be your forms success case.

    Now, after user is done on Azure AD, user will get redirected back to your application. If you still need more information after this step, you should show another form while holding the data you have received from AD (I would suggest you to save this to db once you get it).

    I believe this should fix your issue.

    Regards,

    Mehmet

Please Sign in or register to post replies

Write your reply to:

Draft