corbado / javascript

MIT License
6 stars 1 forks source link

Update init component logic #306

Closed incorbador closed 2 weeks ago

incorbador commented 3 weeks ago

Why

Currently, the initialization logic for the component goes like this:

  1. If cbo_auth_process exists in localstorage, fetch state from backend (GET /process call) => PROCESS_STATE
  2. If PROCESS_STATE was loaded => update the component state based on PROCESS_STATE

Now, let's take a look at this example:

What we want: If a user opens a new tab with https://component-url#passkey-append => show her the passkey-append screen => she can continue her process If a user opens a new tab with https://component-url#signup-init => load the component in initial state

Acceptance criteria

Implementation idea: During initialization after step 1, we should compare the state that we get from the backend with the hashcode that we have in the frontend. If the frontend hashcode does not match the current block returned by the backend, we should start a new process.