Well normally people want a long-lived token:

Session["token"] = AuthSubUtil.exchangeForSessionToken(token,
null).ToString();

I missed the fact you weren't doing this. The one problem with a "one time
use token" (session=0) is that it expires after being used once. I'm not
sure if it plays nicely with secure authsub either. I suppose it should, but
sometimes it has issues. If you still have problems with secure AuthSub
perhaps try synchronizing your system clock? If the timestamp is out of date
that gets sent to the server, the Authorization header will be rejected.

Cheers,
-Jeff

On Fri, Jul 18, 2008 at 1:24 AM, 박동희 <[EMAIL PROTECTED]> wrote:

> thanks~ Jeff
>
> I modified my source correctly  :)
> using session token..
>
> but I'm eager to know If I  want to use onetimeUseToken and session = 0
> and secure = 1
> , following code is wrong?
>
> >>  myService.setAuthSubToken(onetimeUseToken, privateKey);
>
>
> AuthSubUtil.getRequestUrl() ?
> Ok.. I'll try it..  ^ ^;;;
>
>
>
>
> 2008/7/18 Jeff Fisher <[EMAIL PROTECTED]>:
>
>  Your problem is here:
>>
>>
>> <input type="hidden" id="session" name="session" value="0">
>>
>> This should be value="1" since you want a long-lived session token.
>>
>> Out of curiosity why are you using <form> instead of using
>> AuthSubUtil.getRequestUrl() to construct the URL directly?
>>
>> Cheers,
>> -Jeff
>>
>>
>>
>> On Thu, Jul 17, 2008 at 4:43 AM, dongs <[EMAIL PROTECTED]> wrote:
>>
>>>
>>> plz, help me..
>>> I received error message, when I run my web application.
>>>
>>> first I send request  to "http://www.google.com/accounts/
>>> AuthSubRequest/ <http://www.google.com/accounts/AuthSubRequest/>"
>>> and received token
>>>
>>> How can I modify my code to run my web app?
>>>
>>>
>>> 1. send request for token
>>> ===================
>>> <form name="testForm" action="https://www.google.com/accounts/
>>> AuthSubRequest" method="GET">
>>> <input type="hidden" id="scope" name="scope" value="http://
>>> www.google.com/calendar/feeds/">
>>> <input type="hidden" id="session" name="session" value="0">
>>> <input type="hidden" id="secure" name="secure" value="1">
>>> <input type="hidden" id="next" name="next" value="http://
>>> wishclipr.nanuminet.com/yoko/dongs/test2.wcr">
>>> </form>
>>> <input type="button" onClick="testForm.submit()">
>>> ====================
>>>
>>> 2. get token and try to get calendar element..(http://
>>> wishclipr.nanuminet.com/yoko/dongs/test2.wcr?token=dsfjksji3435dkfj
>>> ==========================================
>>> public ModelAndView test2(
>>>     HttpServletRequest request,
>>>     HttpServletResponse response) throws Exception {
>>>
>>>    // receive Token <-  I checked
>>>     String onetimeUseToken =
>>> AuthSubUtil.getTokenFromReply(request.getQueryString());
>>>
>>>     CalendarService myService = new CalendarService("exampleCo-
>>> exampleApp-1.0");
>>>
>>>     java.security.PrivateKey privateKey =
>>>
>>> AuthSubUtil.getPrivateKeyFromKeystore(getServletContext().getRealPath
>>>                       ("AuthSub.jks"), "mypassword","AuthSub",
>>> "mypassword");
>>>
>>>    myService.setAuthSubToken(onetimeUseToken, privateKey);
>>>
>>> URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/
>>> owncalendars/full<http://www.google.com/calendar/feeds/default/owncalendars/full>
>>> ");
>>>
>>> CalendarFeed resultFeed = myService.getFeed(feedUrl,
>>> CalendarFeed.class);  // <---  The error occured in this code
>>>
>>>        System.out.println("Your calendars:");
>>>        System.out.println();
>>>
>>>        ArrayList calList = new ArrayList();
>>>
>>>        for (int i = 0; i < resultFeed.getEntries().size(); i++) {
>>>          CalendarEntry entry = resultFeed.getEntries().get(i);
>>>          System.out.println("\t" + entry.getTitle().getPlainText());
>>>          calList.add(entry.getTitle().getPlainText());
>>>        }
>>>
>>> return new ModelAndView("calList");
>>> }
>>>
>>> 3. Error Message
>>> ======================
>>> org.springframework.web.util.NestedServletException: Request
>>> processing failed; nested exception is
>>> com.google.gdata.util.AuthenticationException: Token invalid - Invalid
>>> AuthSub token.
>>> <HTML>
>>> <HEAD>
>>> <TITLE>Token invalid - Invalid AuthSub token.</TITLE>
>>> </HEAD>
>>> <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
>>> <H1>Token invalid - Invalid AuthSub token.</H1>
>>> <H2>Error 401</H2>
>>> </BODY>
>>> </HTML>
>>>
>>>
>>>
>>> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:
>>> 583)
>>>
>>>
>>> org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:
>>> 501)
>>>        javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>>>        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>
>>>
>>> root cause
>>>
>>> com.google.gdata.util.AuthenticationException: Token invalid - Invalid
>>> AuthSub token.
>>> <HTML>
>>> <HEAD>
>>> <TITLE>Token invalid - Invalid AuthSub token.</TITLE>
>>> </HEAD>
>>> <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
>>> <H1>Token invalid - Invalid AuthSub token.</H1>
>>> <H2>Error 401</H2>
>>> </BODY>
>>> </HTML>
>>>
>>>
>>> com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(Unknown
>>> Source)
>>>
>>>
>>> com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(Unknown
>>> Source)
>>>
>>>  com.google.gdata.client.http.HttpGDataRequest.checkResponse(Unknown
>>> Source)
>>>        com.google.gdata.client.http.HttpGDataRequest.execute(Unknown
>>> Source)
>>>        com.google.gdata.client.http.GoogleGDataRequest.execute(Unknown
>>> Source)
>>>        com.google.gdata.client.Service.getFeed(Unknown Source)
>>>        com.google.gdata.client.Service.getFeed(Unknown Source)
>>>        com.google.gdata.client.GoogleService.getFeed(Unknown Source)
>>>        com.google.gdata.client.Service.getFeed(Unknown Source)
>>>
>>>
>>> wishclipr.test.controller.DongsTestController.test2(DongsTestController.java:
>>> 92)
>>>        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>>
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>>> 39)
>>>
>>>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
>>> 25)
>>>        java.lang.reflect.Method.invoke(Method.java:585)
>>>
>>>
>>> org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:
>>> 473)
>>>
>>>
>>> org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:
>>> 410)
>>>
>>>
>>> org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:
>>> 153)
>>>
>>>
>>> org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:
>>> 48)
>>>
>>>
>>> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:
>>> 875)
>>>
>>>
>>> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:
>>> 809)
>>>
>>>
>>> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:
>>> 571)
>>>
>>>
>>> org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:
>>> 501)
>>>        javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>>>        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>
>>> ====================================================
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>

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

Reply via email to