Thanks Alexander for your help, Koen,
Unfortunately, it turns out that makeRequest calls go through a proxy, which strips Authorization headers from HTTP requests, so you can not do this with makeRequest. Please consider another authentication method, like OAuth. You can use OAuth with makeRequest. For more details, please see: http://code.google.com/apis/gadgets/docs/oauth.html That said, it might be difficult to implement it with gwt-gadgets library. I'll try to find useful information about this, but I don't have any just right now. Sorry I could not tell this to you earlier. -- Takashi On Mon, May 23, 2011 at 8:25 PM, Alexander Steshenko <[email protected]>wrote: > Ah, it should be the Basic authorization, of course. i.e. : > > options.setHeader("Authorization", "Basic " + > Base64.encode("[email protected]:secret")); > > About the debugging: I don't know a more profound way in this case than > using "alerts" as you already do and comparing what you get with what you > expect. Even though it's not convenient at all it should be enough to > achieve your goals. For business logic development you could use some unit > tests and mocks replacing the Gadgets' services. > > > On Mon, May 23, 2011 at 3:15 PM, Koen Maes <[email protected]> wrote: > >> Hi Alexander, >> >> I gave it a go, but now running into status 401 ( not authorized ) >> >> text : {"errors":{"nonauthorizedrequest":"Non-Authorized >> Request"},"status":"failed"} >> status: 401 >> >> That is an improved, communication with the backend server is working now, >> I guess. >> >> How do I debug a gadget into this detail ? >> I picked up a client side Base64 encoding algo from the web, since GWT >> does not seem to have one. >> >> Got any good advice for me how to debug from here ? >> >> >> RootPanel rootPanel = RootPanel.get(); >> rootPanel.add(new Label("Test categories")); >> GadgetsIo io = IoProvider.get(); >> ResponseReceivedHandler<JavaScriptObject> handler = new >> ResponseReceivedHandler<JavaScriptObject>() { >> @Override >> public void onResponseReceived( >> ResponseReceivedEvent<JavaScriptObject> event) { >> Response<JavaScriptObject> response = event.getResponse(); >> String text = response.getText(); >> int status = response.getStatusCode(); >> Window.alert("text : " + text); >> Window.alert("status: " + status); >> } >> }; >> RequestOptions options = RequestOptions.newInstance(); >> options.setHeader("Accept", "application/json"); >> options.setMethodType(MethodType.GET); >> options.setHeader("Authorization", Base64.encode("[email protected]: >> secret")); >> String url = "https://secure.service.com/contacts/categories"; >> io.makeRequestAsJso(url, handler, options); >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "iGoogle Developer Forum" 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-Gadgets-API?hl=en. >> > > > > -- > Alexander Steshenko* | *http://lcf.name > > -- > You received this message because you are subscribed to the Google Groups > "iGoogle Developer Forum" 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-Gadgets-API?hl=en. > -- Takashi Matsuo Developer Relations Developer Advocate for Google App Engine/iGoogle Google Japan, Inc. -- You received this message because you are subscribed to the Google Groups "iGoogle Developer Forum" 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-Gadgets-API?hl=en.
