Comment on page
Verifying wallet ownership
Authenticating a wallet means verifying the user is in control of the wallet they are connecting with. Wallet authentication is enabled by default, meaning that the user will be prompted to sign a message verifying their wallet once they click the 'Connect' button.
Once the user signs the request above, two things occur:
- 1.A window object is added
- 2.A window event is emitted
A window object containing the authentication state and connected address is added once a user has verified their wallet address. The object is stored in
window.manifold, and has the following structure:
"address": "<THE WALLET ADDRESS>"
"oauthToken": "<THE AUTHENTICATION TOKEN>"
"dataClient": <An instance of the data client>
This object is updated if the user switches wallets or disconnects.
There are two window events that are fired upon authentication and disconnect. These events can be observed by adding event listeners via
m-authenticatedThis event is fired upon authentication or if the user switches their wallet address. The event will also contain a reference to the Data Client, which you can access via
m-unauthenticatedThis event is fired if the user disconnects from the website by clicking the 'Disconnect' button.Additionally, there will be an
m-authenticatedevent fired upon authentication (and
m-unauthenticatedif they click the "Disconnect" button).
Last modified 10mo ago