Passport SDK v5.0
  • Overview
  • Account Lifecycle
  • Integration
    • Client Side Enablement
    • Credenza Presence (Optional Visual Elements)
    • Account Provisioning (Sign-up)
      • New Authentication System
      • Existing Authentication System - New Customer
      • Existing Authentication System - Existing Customer
  • Passport Subsequent Logins
  • Post-Login Capabilities
    • Account Information Access
    • Blockchain Wallet Access
  • Smart Contract Interactions
    • Instantiating The Contract Object (Server-Side)
    • Instantiating The Contract Object (Client-side)
    • Calling Contracts
  • Monetary Transactions
  • Appendix I: Passport Configuration Options
    • Magic
    • Ethers.js
    • Installation
    • Usage
    • Passport Instance Properties
    • Passport Static Properties
    • Modes
    • Supported query params
  • Transaction UI v3.0 (now part of Passport)
    • Magic
    • Ethers.js
    • Installation
    • Usage
    • Apple Pay
    • Google Pay
    • Methods
    • Events
  • Appendix II: MetaMembership Contract Access
  • Appendix III: Ledger Contract Access
  • Appendix IV: Decentralized Commerce Configuration
Powered by GitBook
LogoLogo

©2023 Credenza. All rights reserved.

On this page
  1. Integration
  2. Account Provisioning (Sign-up)

Existing Authentication System - Existing Customer

PreviousExisting Authentication System - New CustomerNextPassport Subsequent Logins

Last updated 2 years ago

For existing customers, the best practice is to minimize the friction of augmented the user account with blockchain capability. The best approach would be to create a button that triggers the login process with the user’s email address inferred in the request. We’d suggest two options:

  • A button on an account page that calls the same passport.login method that is called above:

user=await passport.login('magicLink',{'email': emailValue})

In this situation, the webpage should already be aware of the email address, so emailValue can be easily populated and the passport Object will automatically trigger the passworldless authentication workflow.

  • Also, an email can be sent to existing users touting the benefits of the program, and offering a link to register. The link can embed the email address and the receiving URL can process the link and trigger the registration/login workflow. For example, you could put a link in the email that redirects to and includes the user’s address.

    Unfortunately, the link cannot be pre-emptive as our links only stay active for 10 minutes and need to be spawned by a browser running a Passport object to receive notification of confirmed login. In the example below, this code runs on a Passport-enabled page and pulls the email address from the querystring (we’d recommend encrypting and decrypting, but for simplicity, we skip that step).

    <script>
      const start = async () => {
          const passport = new window.CredenzaPassport({
        	    chainId: '4',
        	    config: {  /* Headless */   	    },
           })
          const params = new Proxy(new URLSearchParams(window.location.search), {
    	get: (searchParams, prop) => searchParams.get(prop),});
          let emailValue = params.email; // "some_value"
          if (emailValue)
    	await passport.login('magicLink', {'email': emailValue})
          passport.onLogin(async (data) => {
             window.location.href=’ https://www.yoururl.com/registerSuccess’;
           })
        }
        start();

    </script>

Note that if a user clicks this after they have already registered, the experience will be the same (although the link does expire after 10 minutes).

So would take you to a page where the workflow is triggered and, upon confirmation of login check, redirects you to a success page where you can welcome the user and provide some additional information (or maybe collect some additional information).

https://www.yoururl.com/registerBlockchain
https://www.yoururl.com/registerBlockchain?email=bobo@credenza3.com