I’m using the new HttpClient class, part of the WCF REST Starter Kit, to authenticate to Google’s Map Data service. I’ve got my ClientLogin authentication token, but I’m not sure how to take 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: “the GET request requires an Authorization HTTP header, passing an AuthSub or GoogleLogin token.” I have the token, I just don’t know how to create that Authorization HTTP header correctly through that api. Anyone help?
Instead of using the CreateBasic static method, you can just pass the complete authorization header to the constructor of the Credential class. e.g.