generateComponentToken
API KeySRP
Mint a short-lived component token for embedded widgets. This mutation supports both API-key and SRP authentication.
The returned token is intended for widget/component use, such as the Document Viewer or Signer. Pass it to the widget token attribute instead of exposing your Developer Portal API key in browser code.
Input
Return Type
Use expiresIn and expiresAt from the response to decide when to refresh the token.
Examples
Document Viewer token
mutation GenerateViewerToken {
generateComponentToken(input: {
component: LS_DOCUMENT_VIEWER
}) {
token
tokenType
expiresIn
expiresAt
}
}
Signer token (by recipientId)
mutation GenerateSignerToken {
generateComponentToken(input: {
component: LS_SIGNER
signer: {
recipientId: "cmVjMTIzNDU2"
}
}) {
token
tokenType
sessionId
expiresIn
expiresAt
}
}
Signer token (by sessionId)
mutation GenerateSignerToken {
generateComponentToken(input: {
component: LS_SIGNER
signer: {
sessionId: "c2VzMTIzNDU2"
}
}) {
token
tokenType
sessionId
expiresIn
expiresAt
}
}
Provide either recipientId or sessionId in the signer scope, but not both. The documentViewer and signer scope fields specify which resource the token is for.