How to set up GoogleLogin request authorization header using new WCF REST HttpClient API

I am using the new HttpClient class that is part of the WCF REST Starter Kit to authenticate with the Google Map Data service. I have a ClientLogin authentication token, but I'm not sure how to get this instruction:

GET http://maps.google.com/maps/feeds/maps/userID/full

Authorization: GoogleLogin AUTH = "authorization_token"

and make it work in this code:

var auth = [myAuthToken]
var http = new HttpClient("http://maps.google.com/maps/feeds/maps/[myUserName]/full");
http.DefaultHeaders.Authorization = Microsoft.Http.Headers.Credential.CreateBasic("GoogleLogin", "auth=" + auth);
var response = http.Get();

The docs say , "A GET request requires an HTTP authorization header that passes an AuthSub or GoogleLogin token." I have a token, I just don’t know how to correctly create this HTTP authorization header through this api. Anyone help?

+3
1

CreateBasic Credential. .

client.DefaultHeaders.Authorization = new Credential("GoogleLogin auth=" + auth);
+2

Source: https://habr.com/ru/post/1757983/


All Articles