@privy-io/cross-app-provider
library to communicate via the Privy
cross-app protocol. Your app handles the user interfaces, and Privy handles the rest.
@privy-io/cross-app-provider
SDK is a vanilla JavaScript library. We recommend using this
library alongside @privy-io/react-auth
for the best development experience.@privy-io/cross-app-provider
SDK and how they
integrate with the React SDK. For a more complete reference implementation, see the
cross-app provider starter repo.
Set up a cross-app provider client
Build the connect experience
client
to handle parsing input and responging to the requesting app.First, use the client.getConnectionRequestFromUrlParams
method when the page loads
to read the request into your app.The connection request
requesterPublickey
, used to generate the shared secret for encrypted communicationrequesterOrigin
, used to identify the requester and as the targetOrigin
in calls to window.postMessage
client.acceptConnection
and client.rejectConnection
to allow your
users to explicitly approve or deny the connection request respectively via clicking
a button like so:Build the request experience
client.getVerifiedWalletRequest
to decrypt, parse and
verify the input. This method will also return the connection
object used to
communicate a result back to the requester.client.handleSuccess
, for example responding to a signature request:client.rejectRequest
to send an
error message to the requester:client.handleError
method to pass the error back to the requester:Upgrade your clients
@privy-io/cross-app-connect
Set up your custom URLs in the Privy Dashboard
Custom URLs
,
input the URL(s) where your pages are hosted, and save your changes.