INTERACT FORUM

Please login or register.

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

Author Topic: MCWS Token works in browser not with RestSharp  (Read 3134 times)

RaphRock

  • Recent member
  • *
  • Posts: 11
MCWS Token works in browser not with RestSharp
« on: January 17, 2014, 10:14:02 am »

Hello,

I have a Library that requires authentication.

In the browser (FF)
With http://localhost:52199/MCWS/v1/Authenticate, and giving my credentials in the browser pop up I retrieve my token.
Then I do a call to
http://localhost:52199/MCWS/v1/Playback/Playlist?Zone=-1&Token=[received token]
and works like a charm..

Then I try to do the same in code (C#) with RestSharp :
With a HttpBasicAuthenticator(username,password) I can retrieve a token.  (it seems it is different than the one I receive in the browser, but I don't know how the token is generated).
But appending the token to a request still gets me a "Unauthorised" response...

I'm hoping someone has an idea of what I am missing or doing wrong...

thnx
Raf
Logged

RaphRock

  • Recent member
  • *
  • Posts: 11
Re: MCWS Token works in browser not with RestSharp
« Reply #1 on: January 17, 2014, 11:21:41 am »

Stupid me...

I used  "request.AddParameter("Token", "mthdk5aE", ParameterType.UrlSegment);"

when it should be "request.AddParameter("Token", Token, ParameterType.QueryString);"

Works like it should now !

sorry to bother ya all..

Raf
Logged
Pages: [1]   Go Up