INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: MCWS Authentication Issue in MC22  (Read 4585 times)

rshostak1

  • Member
  • *
  • Posts: 4
MCWS Authentication Issue in MC22
« on: August 26, 2017, 07:50:50 pm »

I'm not having any luck calling the MCWS  Playlist/Delete primitive from Javascript running on a machine that is on the same subnet as the MC server (MC22).   The problem seems to be with authentication.  Unlike most MCWS primitives (which work fine for me without authentication), Playlist/Delete seems to require it.   I'm authenticating by appending &Token=[token] to the URL  where [token]  is obtained via a successful call to Authenticate.   If I submit the URL from the server machine itself (using the token obtained on that machine), it works okay -- but not from a different machine on the same subnet.

Here is the submitted URL (where 192.168.0.2 is the server IP and xxxxx is the authentication token:

http://192.168.0.2:52199/MCWS/v1/Playlist/Delete?Playlist=MyExistingPlaylist&PlaylistType=Path&Token=xxxxx

When I call this, the returned Response status is failure and the playlist is not deleted.   Any idea what's wrong?

Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10968
Re: MCWS Authentication Issue in MC22
« Reply #1 on: August 27, 2017, 04:00:27 am »

The only way this call would fail is if the Playlist wasn't actually found. An auth failure should return an actual auth error message, not a generic Failure.
Logged
~ nevcairiel
~ Author of LAV Filters

rshostak1

  • Member
  • *
  • Posts: 4
Re: MCWS Authentication Issue in MC22
« Reply #2 on: August 28, 2017, 01:18:10 am »

Hi, Hendrik -

Many thanks for the reply. 

I think my problem is actually that I'm misunderstanding how to set things up to be able to be authenticated (for primitives such as Playlist/Delete that require it) from a Javascript application.   

I gather that I first need to check the Authentication box under Options/Media Network in MC.   If I do that, it prompts for a UserName/Password which I make up and supply.   But then what?  I am not running the application in a browser, so am not prompted for a username/password.  If I instead append the token supplied by Authenticate to the Playlist/Delete URL I am submitting from JavaScript, the call fails in some fashion.

I'm sure that the playlist in question actually exists, and in fact the Playlist/Delete URL I am using does work when run from a browser, once I supply the username/password to the dialog brought up by the browser.

Would be very grateful if you could tell me the exact steps I should be following.  Thanks muchly! - Rob

Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10968
Re: MCWS Authentication Issue in MC22
« Reply #3 on: August 28, 2017, 03:31:10 am »

You can either supply the token or just send auth data with every request (using the Basic auth scheme) - which is often easier to do.
Logged
~ nevcairiel
~ Author of LAV Filters

rshostak1

  • Member
  • *
  • Posts: 4
Re: MCWS Authentication Issue in MC22
« Reply #4 on: August 28, 2017, 06:46:53 pm »

Hendrik, please give a concrete example of "sending auth data with every request using the Basic auth scheme" - or perhaps you could point me to the relevant documentation.

I'm not sure exactly what "auth data" or "basic auth scheme" refer to in this context.   For example, are the auth data you are talking about the username/password set in Options/Media Network/Authentication on the server?  And if so, would the request URL simply append "&UserName=XXX&Password=YYY" to the URL?

Again, most of the calls I'm making from the JavaScript application running on another machine on the LAN work fine, so my http calls are definitely accessing the server.

Sorry to keep asking about this -- I've not actually done much MC development before, as you can tell, so a concrete example that doesn't assume too much understanding would be really useful.  Thanks so much.

Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10968
Re: MCWS Authentication Issue in MC22
« Reply #5 on: August 29, 2017, 07:22:01 am »

Basic authentication is not MC specific but a standard feature to authenticate requests in HTTP using a username and password (which you configure in MC).
https://en.wikipedia.org/wiki/Basic_access_authentication

How exactly to implement this in JavaScript depends on how you do the connection in the first place.
Logged
~ nevcairiel
~ Author of LAV Filters

rshostak1

  • Member
  • *
  • Posts: 4
Re: MCWS Authentication Issue in MC22
« Reply #6 on: August 29, 2017, 04:52:25 pm »

Ah, okay, thanks, that's helpful.   Unfortunately, I'm writing a JRiver driver for use in an RTI IDE using embedded JavaScript, and the networking library they provide does not give me much control over the connection - all I can do easily is "get" a URL and process the XML response.  So I'll go back to working with passing in the Token returned by Authenticate.   

In any case, you'd mentioned earlier that the Playlist/Delete failure probably means that the playlist to be deleted could not be found.  Is there any other cause you can think of? My driver exercises more than one function that takes an existing playlist as a parameter, and I haven't had any problem with the others. 

Also, the reason I focused on authentication as a possible problem is that Playlist/Delete appears to require it, unlike the other functions I'm calling.  Is it indeed true that this particular function does require authentication?
Logged
Pages: [1]   Go Up