Hi there:

I just want to use the Google Calendar Data API to list a user's
calendars.
I've tried 2 days to get my code work.  I've also read the other
threads, but I still stuck at this error:

Token invalid - AuthSub token has wrong scope
Error 401

Could anyone kindly help me to solve this problem?

Here are the steps about how I got the token and sent the request to
Google Calendar server

1. Get the single-use token by sending the request to
    htttps://www.google.com/accounts/AuthSubRequest?
    scope=http://www.google.com/calendar/feeds/
&secure=0&session=1&next=http://foolme.com/check?Lang%3Den

2. Upgrade the single-use token to session token by sending the
request to
    https://www.google.com/accounts/AuthSubSessionToken
    with the header
        Authorization: AuthSub token="CPmBtN6OFxDi-PzS-vxxxx8B"

3. Use the returned session token ("CPmBtN6OFxD2tNzX_vxxxx8B")
    to send the request to the following addresses for listing my
calendars
    https://www.google.com/calendar/feeds/[EMAIL PROTECTED]
    https://www.google.com/calendar/feeds/default
    https://www.google.com/calendar/feeds/[EMAIL PROTECTED]/private/full
    (I've tried these three but got the same error code)
    with the header
        Content-Type: application/x-www-form-urlencoded
        Authorization: AuthSub token="CPmBtN6OFxD2tNzX_vxxxx8B"

    BTW, the session token is obtained from the response body rather
than the "header" of step 2.

4. and finally get the error 401 - Token invalid - AuthSub token has
wrong scope with the message(header & body) returned:

cache-control: private
connection: Close
date: Thu, 24 May 2007 09:21:47 GMT
content-type: text/html;
charset=UTF-8
www-authenticate: AuthSub realm="https://www.google.com/accounts/
AuthSubRequest"
server: GFE/1.3
content-length: 213

<HTML>
<HEAD>
<TITLE>Token invalid - AuthSub token has wrong scope</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Token invalid - AuthSub token has wrong scope</H1>
<H2>Error 401</H2>
</BODY>
</HTML>

I really appreciated if someone could kindly help me to solve this
problem.
Thanks

Alvin


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" 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/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to