credential-handler / authn.io

Credential Mediator Polyfill
https://github.com/w3c-ccg/credential-handler-api
Other
44 stars 8 forks source link

Create a single agent/v2 route for faster polyfill loading #49

Closed dlongley closed 6 years ago

dlongley commented 7 years ago

We currently use multiple routes for the credential agent and the credential polyfill API requires the appropriate agent URL to be provided in each API call. Also, when an API call occurs, the DOM is manipulated to add a dialog and iframe to the agent URL and then the user must wait for the iframe to load and show its UI. We have optimized this so it happens fairly quickly, but a better design can make it practically instant.

We can address all these issues with a new design:

  1. Requirement to pass agent URL to every polyfill API call.
  2. User must wait for iframe to load before agent UI can be shown.
  3. Repetitious code on different agent routes.

To address these we should instead create a single route that handles all credential agent traffic. This keeps the organization simpler and the implementation more DRY on the auth.io end. The URL for this route can be set once on polyfill inclusion (with a default to auth.io) instead of passed for each call.

The polyfill can load this single URL into a persistent iframe that is only shown when a polyfill call is made. This way websites that use the polyfill can load the agent web application early and have it be ready to receive credential API requests as they occur on the page. It would allow for immediate rendering of the UI following a user action such as a button press.

dlongley commented 6 years ago

Faster loading already implemented.