|
| 1 | +--- |
| 2 | +title: Migrating Custom Authentication from v7 to v10 |
| 3 | +description: |
| 4 | + Comprehensive guide for migrating Web3Auth custom authentication configurations from verifiers to |
| 5 | + connections in v10. |
| 6 | +sidebar_label: Custom Authentication Migration |
| 7 | +--- |
| 8 | + |
| 9 | +import Tabs from "@theme/Tabs"; |
| 10 | +import TabItem from "@theme/TabItem"; |
| 11 | + |
| 12 | +# Web3Auth v10 Custom Authentication Migration Guide |
| 13 | + |
| 14 | +This guide focuses specifically on migrating custom authentication configurations from Web3Auth v7 |
| 15 | +to v10. This covers the transition from "Verifiers" to "Connections" and "Grouped Connections". This |
| 16 | +is a supplementary guide to the main [v7 to v10 migration guide](./modal-v7-to-v10.mdx). |
| 17 | + |
| 18 | +## Overview |
| 19 | + |
| 20 | +In v7, custom authentication used `verifier` and `aggregate verifier` configurations for linking |
| 21 | +accounts from different social providers to the same underlying user wallet. In v10, this system is |
| 22 | +streamlined with "Connections" and "Grouped Connections" configured on the Web3Auth Developer |
| 23 | +Dashboard, significantly reducing client-side code complexity. |
| 24 | + |
| 25 | +## Key Changes & Mapping |
| 26 | + |
| 27 | +### 1. Single Verifiers (v7) to Single Connections (v10) |
| 28 | + |
| 29 | +Single verifiers in v7 become connections in v10: |
| 30 | + |
| 31 | +```typescript |
| 32 | +// remove-start |
| 33 | +const openloginAdapter = new OpenloginAdapter({ |
| 34 | + adapterSettings: { |
| 35 | + loginConfig: { |
| 36 | + google: { |
| 37 | + verifier: "YOUR_GOOGLE_VERIFIER_NAME", // v7 verifier name |
| 38 | + typeOfLogin: "google", |
| 39 | + clientId: "YOUR_GOOGLE_CLIENT_ID.apps.googleusercontent.com", |
| 40 | + }, |
| 41 | + }, |
| 42 | + }, |
| 43 | +}); |
| 44 | + |
| 45 | +web3auth.configureAdapter(openloginAdapter); |
| 46 | +await web3auth.initModal(); |
| 47 | +// remove-end |
| 48 | + |
| 49 | +// add-start |
| 50 | +const web3AuthOptions: Web3AuthOptions = { |
| 51 | + clientId: "YOUR_CLIENT_ID", |
| 52 | + // ... |
| 53 | + modalConfig: { |
| 54 | + connectors: { |
| 55 | + [WALLET_CONNECTORS.AUTH]: { |
| 56 | + loginMethods: { |
| 57 | + google: { |
| 58 | + name: "Google Login", |
| 59 | + authConnectionId: "YOUR_GOOGLE_AUTH_CONNECTION_ID", // v10 connection ID |
| 60 | + }, |
| 61 | + }, |
| 62 | + }, |
| 63 | + }, |
| 64 | + }, |
| 65 | +}; |
| 66 | + |
| 67 | +// OR v10: connectTo with a single connection |
| 68 | +// await web3auth.connectTo(WALLET_CONNECTORS.AUTH, { |
| 69 | +// authConnection: AUTH_CONNECTION.GOOGLE, |
| 70 | +// authConnectionId: "YOUR_GOOGLE_AUTH_CONNECTION_ID", |
| 71 | +// }); |
| 72 | +// add-end |
| 73 | +``` |
| 74 | + |
| 75 | +#### Action |
| 76 | + |
| 77 | +Your existing v7 single verifiers will be automatically migrated to "Connections" on the new |
| 78 | +Web3Auth Developer Dashboard. Locate your migrated Connection, note its `authConnectionId`, and use |
| 79 | +this ID in your v10 client code (`modalConfig` or `connectTo`). Remove any v7 `OpenloginAdapter` |
| 80 | +configuration previously used for this verifier. |
| 81 | + |
| 82 | +### 2. Aggregate Verifiers (v7) to Grouped Connections (v10) |
| 83 | + |
| 84 | +Aggregate verifiers in v7 become grouped connections in v10: |
| 85 | + |
| 86 | +```typescript |
| 87 | +// remove-start |
| 88 | +const openloginAdapter = new OpenloginAdapter({ |
| 89 | + adapterSettings: { |
| 90 | + loginConfig: { |
| 91 | + google: { |
| 92 | + // Part of an aggregate verifier |
| 93 | + verifier: "MY_AGGREGATE_VERIFIER_NAME", // Main aggregate verifier name |
| 94 | + verifierSubIdentifier: "google-sub-verifier", // Specific sub-verifier for Google |
| 95 | + typeOfLogin: "google", |
| 96 | + clientId: "YOUR_GOOGLE_CLIENT_ID.apps.googleusercontent.com", |
| 97 | + }, |
| 98 | + jwt_email: { |
| 99 | + // Another part of the same aggregate verifier |
| 100 | + verifier: "MY_AGGREGATE_VERIFIER_NAME", |
| 101 | + verifierSubIdentifier: "custom-jwt-sub-verifier", |
| 102 | + typeOfLogin: "jwt", |
| 103 | + clientId: "YOUR_CUSTOM_JWT_CLIENT_ID", // Not always applicable for JWT |
| 104 | + jwtParameters: { |
| 105 | + /* ... JWT specific params like domain, verifierIdField ... */ |
| 106 | + }, |
| 107 | + }, |
| 108 | + }, |
| 109 | + }, |
| 110 | +}); |
| 111 | + |
| 112 | +web3auth.configureAdapter(openloginAdapter); |
| 113 | +await web3auth.initModal(); |
| 114 | +// remove-end |
| 115 | + |
| 116 | +// add-start |
| 117 | +const web3AuthOptions: Web3AuthOptions = { |
| 118 | + clientId: "YOUR_CLIENT_ID", |
| 119 | + // ... |
| 120 | + modalConfig: { |
| 121 | + connectors: { |
| 122 | + [WALLET_CONNECTORS.AUTH]: { |
| 123 | + loginMethods: { |
| 124 | + google: { |
| 125 | + name: "Google Login", |
| 126 | + authConnectionId: "YOUR_INDIVIDUAL_GOOGLE_CONNECTION_ID", // ID of the individual Google connection |
| 127 | + groupedAuthConnectionId: "YOUR_GROUPED_CONNECTION_ID_FROM_DASHBOARD", // ID of the group |
| 128 | + }, |
| 129 | + myCustomJWT: { |
| 130 | + name: "Login with Corp Email", |
| 131 | + authConnectionId: "YOUR_INDIVIDUAL_CUSTOM_JWT_CONNECTION_ID", |
| 132 | + groupedAuthConnectionId: "YOUR_GROUPED_CONNECTION_ID_FROM_DASHBOARD", |
| 133 | + }, |
| 134 | + }, |
| 135 | + }, |
| 136 | + }, |
| 137 | + }, |
| 138 | +}; |
| 139 | + |
| 140 | +// OR v10: connectTo with a grouped connection |
| 141 | +// For Google login part of the group: |
| 142 | +// await web3auth.connectTo(WALLET_CONNECTORS.AUTH, { |
| 143 | +// authConnection: AUTH_CONNECTION.GOOGLE, |
| 144 | +// authConnectionId: "YOUR_INDIVIDUAL_GOOGLE_CONNECTION_ID", |
| 145 | +// groupedAuthConnectionId: "YOUR_GROUPED_CONNECTION_ID_FROM_DASHBOARD", |
| 146 | +// }); |
| 147 | + |
| 148 | +// For Custom JWT login part of the group: |
| 149 | +// const idToken = await getMyIdToken(); |
| 150 | +// await web3auth.connectTo(WALLET_CONNECTORS.AUTH, { |
| 151 | +// authConnection: AUTH_CONNECTION.CUSTOM, |
| 152 | +// idToken: idToken, |
| 153 | +// authConnectionId: "YOUR_INDIVIDUAL_CUSTOM_JWT_CONNECTION_ID", |
| 154 | +// groupedAuthConnectionId: "YOUR_GROUPED_CONNECTION_ID_FROM_DASHBOARD", |
| 155 | +// }); |
| 156 | +// add-end |
| 157 | +``` |
| 158 | + |
| 159 | +You first create individual "Connections" on the dashboard for each auth provider (e.g., one for |
| 160 | +Google, one for your custom JWT). Then, you create a "Grouped Connection" on the dashboard, |
| 161 | +selecting the individual connections you want to group. |
| 162 | + |
| 163 | +#### Action |
| 164 | + |
| 165 | +1. Your existing v7 Aggregate Verifiers (and their sub-verifiers) will be automatically migrated to |
| 166 | + the new v10 dashboard. They will appear as individual "Connections" that are part of a "Grouped |
| 167 | + Connection". |
| 168 | +2. On the v10 dashboard, locate your migrated Grouped Connection. Note its |
| 169 | + `groupedAuthConnectionId`. |
| 170 | +3. For each login method within that group, find the corresponding individual migrated Connection |
| 171 | + and note its specific `authConnectionId`. |
| 172 | +4. Update your v10 client code to use both the `groupedAuthConnectionId` (for the group) and the |
| 173 | + specific `authConnectionId` (for the particular login method being invoked) in `modalConfig` or |
| 174 | + `connectTo` calls. The v7 `verifierSubIdentifier` is no longer used in the client. |
| 175 | + |
| 176 | +## Summary |
| 177 | + |
| 178 | +This dashboard-centric approach, with automatic migration of existing verifiers, simplifies |
| 179 | +client-side logic and provides a more robust way to manage authentication methods. |
| 180 | + |
| 181 | +## Next Steps |
| 182 | + |
| 183 | +Return to the main [v7 to v10 migration guide](./modal-v7-to-v10.mdx) to continue with other |
| 184 | +migration aspects like method name changes and initialization updates. |
0 commit comments