INTERACT FORUM

Windows => Plug-in Development => Topic started by: RaphRock on January 17, 2014, 10:14:02 am

Title: MCWS Token works in browser not with RestSharp
Post by: RaphRock 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
Title: Re: MCWS Token works in browser not with RestSharp
Post by: RaphRock 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