Ozory
Ozory

Reputation: 11

Xamarin HttpClient request

Hi Xamarin Jedi masters !!!

I need a litle help First, I set the value of the Token

user.Token = "[email protected]:1395694497451:799fcaa9f86ff10604ca0c6135313697";

Then I added the property to the Header :)

request.Headers.Add ("Auth-Token", user.Token); <------ HERE !!!

Then I call: var response = client.SendAsync (request).Result;

I´m receiving the message :

Unauthorized: Authentication token was either missing or invalid.

description This request requires HTTP authentication

BUT .. LISTEN !!!

If I put directly.... that way: request.Headers.Add ("Auth-Token", "[email protected]:1395694497451:799fcaa9f86ff10604ca0c6135313697");

works !!!!!!!

Please ..... Somebody tell me how I can fix that and use the value that came from property user.Token......

sorry about my english

Upvotes: 0

Views: 993

Answers (1)

Ozory
Ozory

Reputation: 11

you will not believe!

It was simply remove quotes

@ user.Token.Trim ('"') <---- MAGIC!

Upvotes: 1

Related Questions