You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Prenly App SDK is a JavaScript toolkit tailored for developers looking to integrate their web sites seamlessly with the Prenly native apps, focusing on user authentication and consent management. This repository contains the distribution files for the JavaScript SDK.
Install
npm i prenly-js-bridge
Instantiation
importPrenlyAppSDKfrom"prenly-js-bridge";const{ api }=newPrenlyAppSDK();
API
Functions
Function
Signature
Description
Login
api.login(): Promise<UserDataJwt>
Trigger a login flow in the app.
Logout
api.logout(): Promise<UserDataJwt>
Trigger a logout flow in the app.
Show no access alert
api.showNoAccessAlert(): Promise<void>
Trigger a show no access alert flow in the app.
Get user JWT
api.getUserJwt(): Promise<UserDataJwt>
Retrieve information about the user as a Jwt.
Get user consent
api.getUserConsent(): Promise<UserConsent | null>
Retrieve the current consent that the user granted, or null if no CMP is used.
Show user consent dialog
api.showUserConsentDialog(): Promise<void>
Trigger the display of the consent dialog.
Play or pause audio
api.playPauseAudio(AudioData): Promise<void>
Add audio and play it using the native app player, or pause when playing.
Queue or dequeue audio
api.queueDequeueAudio(AudioData): Promise<void>
Queue or dequeue audio using the native app player.
Set custom data to be displayed in the start page component connected to a webview.
Example
importPrenlyAppSDKfrom"prenly-js-bridge";const{ api }=newPrenlyAppSDK();try{constuserJwt=awaitapi.getUserJwt();// Do something with `userJwt`.}catch(error){// If the promise was rejected, check the error `code`.if(api.isRequestError(error)&&error.code==="rejected"){// ...}}