Adding Duo to a Custom Web App
Main points to keep in mind when planning and setting up the Duo's 2FA into your web application.
- Set it up in the Duo admin panel, and get the three pieces of information
- Secret key
- Identification number
- Hostname of the Duo prompt, which includes the base URI and the path
- Redirect URI - what Duo will call when a 2FA request is approved
- Create the post action for your links or buttons in your web app which pass the link, document or another resource you want to access
- Create "an integration" app that's mainly empty except for catching the post call with the resource user is aiming to access as a parameter
- The post call will call the DuoClient with the information from the Duo admin panel
- Once the user approves the 2FA request, Duo responds by calling the redirect URI resource with the state ID
- The redirect URI resource performs the following:
- Catches the response from Duo and confirms the response is from the same request using the state ID and session management
- Checks if the user authenticated
- Redirects to the final resource
- Either a GET or POST redirect. The POST redirect can be achieved using an automatic form submit. The goal of the POST is to hide the final resource URI and not include it in the URL field.