google app engine - Oauth2 client.Get() email scope returning literal 'userinfo.email' rather than actual email addr in AppEngine Go app -


thr 2016.11.17

lacking suitable simple go lang oauth example, i'm following tutorial attempting retrieve user email appengine oauth2 app.

followed work around obtain new appengine context.

unexpectedly, literal text 'userinfo.email' returned, rather actual email addr.

error handling removed brevity:

ctx := appengine.newcontext(r) 

either ctx := newappengine.newcontext(r)

code := r.formvalue("code") token, err := googleoauthconfig.exchange(ctx, code)  client := googleoauthconfig.client(ctx, token) resp, err := client.get("https://www.googleapis.com/auth/userinfo.email?     access_token=" + token.accesstoken)  defer resp.body.close() data, _ := ioutil.readall(resp.body) str := string(data)          data [[117 115 101 114 105 110 102 111 46 101 109 97 105 108]]         u   s   e   r     n   f   o  .   e   m      l   resp [&{200 ok 200 http/1.1 1 1 map[x-xss-protection:[1; mode=block] expires:[wed, 16 nov 2016 01:37:56 gmt] server:[gse] cache-control:[private, max-age=0] date:[wed, 16 nov 2016 01:37:56 gmt] x-frame-options:[sameorigin] alt-svc:[quic=":443"; ma=2592000; v="36,35,34"] x-content-type-options:[nosniff] transfer-encoding:[chunked] content-type:[text/plain]] 0xc082148ce0 14 [] true map[] 0xc0821a61c0 }] 

insight or appengine go tutorial link appreciated. thank you, robin

scopes

email scope

note: tutorial source link @ end of post


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -