MENU
      License client integration
        • PDF

        License client integration

        • PDF

        Article summary

        This guide helps you to understand how to integrate the license issued through the One Click Multi DRM product with the player.

        Note

        The precautions for issuing licenses are as follows:

        • You must refer to the license issuance guide for each DRM type for the client (player) integration.
        • You must request the license issuance according to the type of the request or implementation measures.
        • The universal commercial player (html5/videojs/shaka) supports licenses in original (binary) types, not in JSON.
        • For FairPlay licenses, you must use the ceritificateUri and certificateRequestHeader to request the license.
        • If you need the response for the FairPlay license in binary, you can obtain the response through GET ​/license​/fairPlayBinary.
        • If you integrate DRM through NCP video player enhancement (VPE), see the VPE content authentication guide.
        • If you request the One Click Multi DRM license using Video Player Enhancement, it will be supported only by versions 1.1.1 and later.
        • You must request all licenses through the information of the device for the DRM content playback and player implementation.

        Player Integration

        Request headers

        Header nameRequirement statusDescription
        x-ncp-apigw-timestampYESThis is the number of milliseconds that have elapsed since January 1, 1970 00:00:00 (UTC)
        If the time difference compared to the API Gateway server is 5 minutes or longer, then the request is considered invalid
        x-ncp-apigw-timestamp:{Timestamp}
        x-ncp-iam-access-keyYESValue of access key ID issued in the NAVER Cloud Platform portal
        x-ncp-iam-access-key:{Sub Account Access Key}
        x-ncp-apigw-signature-v2YESSignature encrypted with the access key ID value and secret key
        x-ncp-apigw-signature-v2:{API Gateway Signature}
        Content-TypeYESSpecifies the request body content type as application/json
        Content-Type: application/json
        x-ncp-region_codeYESRegion code (KR)
        x-drm-tokenYESAn encrypted token value including the necessary data for One Click Multi DRM license issuance
        x-drm-token:{X-DRM-TOKEN}

        X-DRM-TOKEN headers

        You must authenticate X-DRM-TOKEN headers to issue the license through the One Click Multi DRM.
        For the X-DRM-TOKEN header value, enter the following Base64 string value converted from the JSON data.

        • Through the X-DRM-TOKEN header, the One Click Multi DRM product checks whether the user has permissions to the content and site and sets the DRM license rules according to the content security policies set in the requested site.
        Field nameRequirement statusValid valueDescription
        siteIdYESSite ID for license issuance
        contentIdYESUnique ID of content for playback
        Used during DRM packaging. You can enter 3 to 100 characters using English letters, numbers, hyphens (-), and underscores (_).
        drmTypeYESWIDEVINE
        PLAYREADY
        FAIRPLAY
        DRM type that requests license
        responseFormatYESORIGINAL
        JSON
        Response data type for the license request (default value: ORIGINAL)
        * ORIGINAL: data response for the requested binary license
        * JSON: responds in JSON format including the license data and additional information, such as client device ID. Only applicable using token proxy or client SKD
        userIdYesStringUnique user ID of the user that requested the license (user ID managed by the service site or user account playing the DRM content)

        Create X-DRM-TOKEN headers

        The following describes how to create X-DRM-TOKEN.

        1. To request the license, enter the necessary fields, including siteId, contentId, drmType, responseFormat, and userId, in JSON.
        # json
        {"siteId":"drm-20231115142326-nHyNw","contentId":"my-drm-content-sample","drmType":"WIDEVINE","responseFormat":"original","userId":"d41d8cd98f00b204e9800998ecf8427e"}
        Plain text
        1. Encode the entered JSON data to Base64 URL.
        # Base64 Encrypted String
        eyJzaXRlSWQiOiJkcm0tMjAyMzExMTUxNDIzMjYtbkh5TnciLCJjb250ZW50SWQiOiJteS1kcm0tY29udGVudC1zYW1wbGUiLCJkcm1UeXBlIjoiV0lERVZJTkUiLCJyZXNwb25zZUZvcm1hdCI6Im9yaWdpbmFsIiwidXNlcklkIjoiZDQxZDhjZDk4ZjAwYjIwNGU5ODAwOTk4ZWNmODQyN2UifQ==
        Plain text
        Caution

        Be careful not to include spaces or line breaks in JSON during the Base64 encoding process.

        Player integration example

        Examples including X-DRM-TOKEN headers

        //widevine license request sample
        'com.widevine.alpha': {
            src: 'https://uz1urqjj2471.beta-edge.naverncp.com/live/video/ls-20231031105925-YvxnQ/live.mpd', //DRM content playback path applied with DRM encryption
            licenseUri: 'https://multi-drm.apigw.ntruss.com/api/v1/license', //Path for DRM license issuance
            licenseRequestHeader: {
                'X-NCP-REGION_CODE': 'KR',
                'X-ncp-apigw-timestamp': 1698832564997,
                'X-ncp-iam-access-key': 'ft1GKEpjSc53lHuqtAxE',
                'x-ncp-apigw-signature-v2': 'Z0LjTbqFjWtxlRskM8vDj5Uha1FGhE4fzdds2ZO8FrQ=',
                'X-DRM-TOKEN': 'eyJyZXNwb25zZUZvcm1hdCI6Im9yaWdpbmFsIiwic2l0ZUlkIjoiZHJtLTIwMjMxMTAxMDgyMzE2LWRKREdhIiwiY29udGVudElkIjoidGVzdENvbnRlbnRJZCIsImRybVR5cGUiOiJXSURFVklORSJ9'
            } //Necessary apigw authentication and X-DRM-TOKEN header value for the use of One Click Multi DRM product
        },
        
        //playready license request sample
        'com.microsoft.playready': {
            src: 'https://uz1urqjj2471.beta-edge.naverncp.com/live/video/ls-20231031105925-YvxnQ/live.mpd',  //DRM content playback path applied with DRM encryption
            licenseUri: 'https://multi-drm.apigw.ntruss.com/api/v1/license',   //Path for DRM license issuance
            licenseRequestHeader: {
                'X-NCP-REGION_CODE': 'KR',
                'X-ncp-apigw-timestamp': 1698832564997,
                'X-ncp-iam-access-key': 'ft1GKEpjSc53lHuqtAxE',
                'x-ncp-apigw-signature-v2': 'Z0LjTbqFjWtxlRskM8vDj5Uha1FGhE4fzdds2ZO8FrQ=',
                'X-DRM-TOKEN': 'eyJyZXNwb25zZUZvcm1hdCI6Im9yaWdpbmFsIiwic2l0ZUlkIjoiZHJtLTIwMjMxMTAxMDgyMzE2LWRKREdhIiwiY29udGVudElkIjoidGVzdENvbnRlbnRJZCIsImRybVR5cGUiOiJXSURFVklORSJ9'
            }      //Necessary apigw authentication and X-DRM-TOKEN header value for the use of One Click Multi DRM product
        },
        
        //fairplay streaming license request sample
        'com.apple.fps': {
            src: 'https://uz1urqjj2471.beta-edge.naverncp.com/live/video/ls-20231031105925-YvxnQ/playlist.m3u8', //DRM content playback path applied with DRM encryption
            certificateUri: 'https://multi-drm.apigw.ntruss.com/api/v1/license/fairPlay',  //Certificate request path necessary for DRM license issuance
            certificateRequestHeader: {
                'X-NCP-REGION_CODE': 'KR',
                'X-ncp-apigw-timestamp': 1698832564997,
                'X-ncp-iam-access-key': 'ft1GKEpjSc53lHuqtAxE',
                'x-ncp-apigw-signature-v2': 'Z0LjTbqFjWtxlRskM8vDj5Uha1FGhE4fzdds2ZO8FrQ=',
                'X-DRM-TOKEN': 'eyJyZXNwb25zZUZvcm1hdCI6Im9yaWdpbmFsIiwic2l0ZUlkIjoiZHJtLTIwMjMxMTAxMDgyMzE2LWRKREdhIiwiY29udGVudElkIjoidGVzdENvbnRlbnRJZCIsImRybVR5cGUiOiJXSURFVklORSJ9'
            }, //Necessary apigw authentication and X-DRM-TOKEN header value for the use of One Click Multi DRM product
            licenseUri: 'https://multi-drm.apigw.ntruss.com/api/v1/license', //Path for DRM license issuance
            licenseRequestHeader: {
                'X-NCP-REGION_CODE': 'KR',
                'X-ncp-apigw-timestamp': 1698832564997,
                'X-ncp-iam-access-key': 'ft1GKEpjSc53lHuqtAxE',
                'x-ncp-apigw-signature-v2': 'Z0LjTbqFjWtxlRskM8vDj5Uha1FGhE4fzdds2ZO8FrQ=',
                'X-DRM-TOKEN': 'eyJyZXNwb25zZUZvcm1hdCI6Im9yaWdpbmFsIiwic2l0ZUlkIjoiZHJtLTIwMjMxMTAxMDgyMzE2LWRKREdhIiwiY29udGVudElkIjoidGVzdENvbnRlbnRJZCIsImRybVR5cGUiOiJXSURFVklORSJ9'
            } //Necessary apigw authentication and X-DRM-TOKEN header value for the use of One Click Multi DRM product
        }
        JavaScript

        Response

        Response example

        HTTP/1.1 200 OK
        Server: nginx
        Date: Fri, 20 Nov 2023 20:53:32 GMT
        Content-Type: application/json;charset=utf-8
        Connection: keep-alive
        Access-Control-Allow-Origin: *
        x-ncp-trace-id: 36c9k60om4p3238cpmc9gm4cj4
        HTTP

        Was this article helpful?

        Changing your password will log you out immediately. Use the new password to log back in.
        First name must have atleast 2 characters. Numbers and special characters are not allowed.
        Last name must have atleast 1 characters. Numbers and special characters are not allowed.
        Enter a valid email
        Enter a valid password
        Your profile has been successfully updated.