Vai al contenuto principale

Autorizzazione Widget

I widget Legalesign sono componenti autenticati. Eseguono chiamate all’API Legalesign internamente, quindi la tua applicazione deve fornire un token al widget prima che possa funzionare.

Il tuo backend genera il token. Il browser riceve solo il token a breve durata necessario al widget.

Metodi per il Token

Ci sono quattro modi per fornire un token a un widget:

MetodoCome funzionaIdeale per
JWT SRP direttoIl tuo server si autentica con SRP e passa il token di accesso JWT direttamente all’attributo token del widgetIntegrazioni che usano già SRP e non necessitano di un token con ambito specifico
Token componente GraphQL (API key)Il tuo server chiama generateComponentToken con una API key, poi passa il token a breve durata restituito al widgetIntegrazioni solo widget che non usano SRP
Token componente GraphQL (SRP)Il tuo server chiama generateComponentToken con un JWT SRP, poi passa il token a breve durata restituito al widgetIntegrazioni SRP che vogliono un token widget con ambito e a breve durata
REST APIIl tuo server chiama l’endpoint REST component-token con una API keyIntegrazioni solo REST che non usano GraphQL

La mutazione GraphQL generateComponentToken supporta sia l’autenticazione con API key sia SRP. Gli endpoint REST supportano solo API key.

Non esporre mai API key o credenziali SRP nel codice del browser. La generazione del token deve avvenire lato server.

Opzioni Token per Widget

WidgetGraphQLRESTRestituisce
Visualizzatore DocumentigenerateComponentToken(input: { component: LS_DOCUMENT_VIEWER })GET /templatepdf/{pdfId}/component-token/token, expiresIn, expiresAt
FirmatariogenerateComponentToken(input: { component: LS_SIGNER, signer: { recipientId } })GET /signer/{signerId}/component-token/token, sessionId, expiresIn, expiresAt

Il token dovrebbe durare circa un’ora. Usa expiresIn o expiresAt dalla risposta per decidere quando aggiornare — non codificare la durata fissa.

Export This Article

Save a copy of this page as PDF or plain text.