6 Replies Latest reply on Aug 26, 2011 6:43 AM by TomKordys

    Tokens in OSMF

    dr_dano

      Hello

       

      I need to use token authentication in OSMF, I think that I need to use DRMTrait, but I don't know how to use it.

       

      What is the right way?

       

      Thanks.

        • 1. Re: Tokens in OSMF
          bringrags Level 4

          When you say "token authentication", do you mean authentication of a stream from FMS (or a CDN), or something different?  If the former, then it depends on which CDN, as they generally do it differently (though it's usually specified as query parameters in the URL).

          • 2. Re: Tokens in OSMF
            RyanOConnell Level 2

            Authentication Tokens are usually used to authenticate against a server, and therefore are usually passed as parameters on the URL to the server.  The only case where you need to use the DRMTrait is if you are using a DRM solution , such as Flash Access.  Here is an example of a URL with  authentication embedded:

             

            rtmp://cp78634.edgefcs.net/ondemand/mp4:mediapmsec/osmf/content/test/SpaceAloneHD_sounas_6 40_700.mp4?auth=daEc2a9a5byaMa.avcxbiaoa8dBcibqbAa8-bkxDGK-b4toa-znnrqzzBvl&aifp=v0001

             

             

            • 3. Re: Tokens in OSMF
              dr_dano Level 1

              Hello.

               

              I mean token authentication against a CDN, so y need to add a parameter to the video url like this:

               

              rtmp://myhost/myapp/mp4:myvideo.mp4?token=29282984rkjd93jdsld9su3jwlkzxud9j3

               

              so I do this:

               

              _src= "rtmp://myhost/myapp/mp4:myvideo.mp4?token=29282984rkjd93jdsld9su3jwlkzxud9j3";

              _element = _mediaFactory.createMediaElement(new URLResource(_src));

               

              When I try to play this MediaElement with my mediaplayer instance it throws a MediaErrorEvent like this:

               

              Error: Playback failed

               

              ¿is this the right way? may be a  problem with my token

               

              thanks for your help

              • 4. Re: Tokens in OSMF
                bringrags Level 4

                Yes, that looks right.

                • 5. Re: Tokens in OSMF
                  dr_dano Level 1

                  may be it looks good, but doesn't work.

                  • 6. Re: Tokens in OSMF
                    TomKordys

                    It does work.

                    OSMF handles token authorisation by default, so you shouldn't do anything else apart from retreivng the urls from base attribute.

                    It usually looks likee this

                     

                    base="rtmpe://domain.com/ondemand?auth=###token###"

                     

                    Token is automatically taken from the URL and my guess it's passed later on as URLVariables object.

                     

                    It seems to be working fine. The only problem is what happens when tokens expire.

                     

                    So let's assume you have a playlist service, that returns you stream location.

                    Once you get a response from your service you have limited time to establish a connection with the token you get.

                    What if token expired and you lost a connection?

                    That pretty much means you need to request new token (that is obviously done outside of OSMF), but then there is no way

                    of actually injecting the token for a reconnect. Or at least I haven't found any.

                     

                    Can someone suggest an acceptable solution to this?