This runs fine, and produces a valid token and what sure looks like an *http.Response. In fact, I know I'm getting one back thanks to reflect.TypeOf(graphResponse). However, when I try to access the Body as I would normally:defer graphResponse.Body.Close()(or in fact, referring to any of the response's fields including its Status) I get a panic:panic: runtime error: invalid memory address or nil pointer dereferenceruntime.panic go/src/pkg/runtime/proc.c:1442runtime.panicstring go/src/pkg/runtime/runtime.c:128runtime.sigpanic go/src/pkg/runtime/thread_linux.c:199app.home app/app.go:33net/http.HandlerFunc.ServeHTTP go/src/pkg/net/http/server.go:704net/http.(*ServeMux).ServeHTTP go/src/pkg/net/http/server.go:942appengine_internal.executeRequestSafely go/src/pkg/appengine_internal/api_prod.go:240appengine_internal.(*server).HandleRequest go/src/pkg/appengine_internal/api_prod.go:190reflect.Value.call go/src/pkg/reflect/value.go:526reflect.Value.Call go/src/pkg/reflect/value.go:334_ _.go:316runtime.goexit go/src/pkg/runtime/proc.c:270Why can I send the entirety of the response to Fprintf and see what's in there, but not access the Body directly?--Cheers,Rich.
--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengin...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Check them and show us the code anyway. Since I can't copy and paste your code and try it, it is easiest to help when I can look at the exact code you're using and the exact output from the program in question (preferably the failing case, with the "_ = graphResponse.Body" that triggers the panic included). Also, use %#v when printing out arbitrary values, not %s.
Where are you seeing the panic? If in the console, it could be caused by a second request made by your browser to /favicon.ico
Andrew
--
Where are you seeing the panic? If in the console, it could be caused by a second request made by your browser to /favicon.ico
219.89.20.120 - - [09/Feb/2013:15:40:47 -0800] "GET /favicon.ico HTTP/1.1" 500 233 - "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17" "sandbox-go.appspot.com" ms=368 cpu_ms=0 cpm_usd=0.000046 instance=00c61b117c89be17bfb76fd5a8c2621759c6e5
Because when you check the error the function returns before trying to use the AccessToken field of the nil tok. That's the cause of the panic.
Always check your errors. :-)
Andrew
--
Because when you check the error the function returns before trying to use the AccessToken field of the nil tok. That's the cause of the panic.
Always check your errors. :-)
--
Hello, i try use all from this topic.It's works fine, but only into dev mode (local)On kilatib.appspot.com i have problem app cannot get token.I don't understand why could you help me
--
>>> What returns nil?accessToken - nil>>> Are you checking all your error return values?yes, check all,- nothing unusual
>>> Are you using the appengine/urlftech package to make HTTP requests?yes2013/3/13 Andrew Gerrand <a...@golang.org>
On 12 March 2013 21:01, kilatiB Shtihno <kil...@gmail.com> wrote:
I'm try use goauth2 lib (https://code.google.com/p/goauth2/)And have challenges on appspot.comI'm deploy source on github and will speak about this file https://github.com/kilatib/appengine_test/blob/master/app/model/Auth.go1. App create oauth link ( by the method GetAuthLink(redirectUri string) string)2. User follows the link.4. After that him redirect back to our app with two params:`soical`,- social name whose chose user for authorization,`code`, - for getting token3. After that calling method `initAccessToken(code string)`, - where `code` - params from get requestMy problem when I'm testing this on my local machine ( with the dev_appserver.py) All fine token generatedBut on appspot.com token 99.9% cases returned nil.What returns nil? Are you checking all your error return values? Are you using the appengine/urlftech package to make HTTP requests? (You can't make normal HTTP requests from App Engine).Andrew