Skip to content

Commit f063b3c

Browse files
committed
Read access token from response data struct
1 parent 360d4d2 commit f063b3c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

oauth.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,17 @@ func oauthCallbackHandler(w http.ResponseWriter, r *http.Request) {
373373
urlPath := sess.Get("path").(string)
374374
sessLock.Unlock()
375375
if Config.Verbose > 0 {
376+
log.Printf("response data %+v", resp)
376377
log.Println("session data", string(data))
377378
log.Println("redirect to", urlPath)
378379
}
379-
if accessToken, ok := oauth2Token.Extra("access_token").(string); ok {
380+
accessToken := resp.OAuth2Token.AccessToken
381+
if accessToken != "" {
380382
bt := fmt.Sprintf("Bearer %s", accessToken)
381383
r.Header.Set("Authorization", bt)
384+
if Config.Verbose > 0 {
385+
log.Printf("new http request headers %+v", r.Header)
386+
}
382387
}
383388
http.Redirect(w, r, urlPath, http.StatusFound)
384389
return

0 commit comments

Comments
 (0)