Hello, and welcome to the Health Developers' Forum!
AuthSub/OAuth and ClientLogin tokens are incompatible, so the 401
error is expected in the case where you're using the ClientLogin token
as an AuthSub token ("service.SetAuthenticationToken(...)"). Besides
this, you'll want to be sure to use the ClientLogin feed for requests
(".../h9/feeds/profile/ui/<profile id>") and not the AuthSub/OAuth
feed (".../h9/feeds/profile/default") when you're authenticating with
ClientLogin. There's a description of the two types of feeds at the
following location:
http://code.google.com/apis/health/docs/2.0/reference.html#Feeds
In order to get the profile id for the ClientLogin feeds, you'll need
to use the "profile list feed", which is described at the previous
location as well.
Let us know how it goes!
Paul (Google)
On Sep 10, 12:01 am, healthy <[email protected]> wrote:
> I am having a hard time getting authenticated from a vb.net client
> app. Here is some code:
>
> Dim authFactory As New GAuthSubRequestFactory(AppService,
> "exampleco-exampleapp-1")
> Dim service As New HealthService(authFactory.ApplicationName)
> service.RequestFactory = authFactory
> service.setusercredentials(username,password)
>
> Dim ProfileQuery As New HealthQuery("https://www..google.com/h9/
> feeds/profile/default")
> ProfileQuery.Digest = True
> Dim feed As HealthFeed = service.Query(ProfileQuery)
>
> I have tried a number of variations including throwing in a call to
> service.QueryClientLoginToken() and
> service.SetAuthenticationToken(service.Credentials.ClientToken).
>
> When I try to put the token into the service or autofactory, I get an
> invalid token 401 error. If I do not, I get an unknown authentication
> header 401 error.
>
> Please help!
--
You received this message because you are subscribed to the Google Groups
"Google Health Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/googlehealthdevelopers?hl=en.