Get and inspect a partner token
The MoonPay Authenticate SDK provides a set of tools and functionalities to integrate with the MoonPay platform seamlessly. This documentation explains a specific feature of the SDK that allows you to obtain a partner token and inspect it for various partner-related details.
The Partner Token in the MoonPay Authenticate SDK is the gateway for partner applications to securely access MoonPay's services on behalf of users. It includes user data, such as name and email, and partner-specific information like permission scopes and cryptocurrency wallet details, enabling tailored and secure interactions.
API overview
The primary functions involved in this feature are:
getPartnerToken()
: This function is used to obtain a partner token from the MoonPay platform.inspectPartnerToken(partnerToken: string)
: This function is used to inspect the partner token and retrieve partner-related information.
1. Obtaining a partner token
let partnerJwt = await sdk.partners.getPartnerToken()
Description:
The getPartnerToken
function is used to request a partner token from the MoonPay platform. The function requires no parameters and returns a partner token that can be used in subsequent SDK calls.
2. Inspecting a partner token
let inspectJwt: MoonPayPartnerVerify = await sdk.partners.inspectPartnerToken(partnerJWT.token)
Description:
The inspectPartnerToken
function allows you to inspect a partner token, verify its authenticity, and retrieve partner-related information.
Parameters:
partnerToken
(String): The partner token obtained through the getPartnerToken function.
Returns:
The function returns a JSON object containing information about the partner token. The structure of the returned object is as follows:
{
"success": true,
"partner": {
"customer": {
"id": "e7459f3a-90f6-4b28-98b7-7cda86284abf",
"firstName": "Elon",
"lastName": "Musk",
"email": "[email protected]"
},
"scopes": ["partner:customer:email", "partner:customer:wallet:read"],
"walletDetails": [
{
"chain": "ethereum",
"address": "0xeA0B9657892321121287128712BC78A89F989AAA"
},
{
"chain": "bitcoin",
"address": "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq"
}
]
}
}
Returned Object Structure:
success
(Boolean): Indicates whether the inspection was successful.
partner
(Object): Contains partner-related information.
customer
(Object): Information about the partner customer.id
(String): The partner customer's unique identifier.firstName
(String, nullable): The partner customer's first name.lastName
(String, nullable): The partner customer's last name.email
(String): The partner customer's email address.
scopes
(Array of Strings): The scopes associated with the partner token.walletDetails
(Array of Objects): Information about the partner customer's wallets, including the blockchain chain and wallet address.
const accounts = await bitcoin.accounts();
const account = accounts[0];
Sign a message:
const signedMsg = await signer.signMessage(msg);
Updated 6 months ago