(raw string)
| 212 | } |
| 213 | |
| 214 | func decodeOAuthState(raw string) (*OAuthState, error) { |
| 215 | b, err := base64.URLEncoding.DecodeString(raw) |
| 216 | if err != nil { |
| 217 | return nil, fmt.Errorf("invalid oauth state encoding") |
| 218 | } |
| 219 | var s OAuthState |
| 220 | if err := json.Unmarshal(b, &s); err != nil { |
| 221 | return nil, fmt.Errorf("invalid oauth state") |
| 222 | } |
| 223 | return &s, nil |
| 224 | } |
| 225 | |
| 226 | func (ua *UserAuth) setCookie(w http.ResponseWriter, name, value string, maxAge int) { |
| 227 | http.SetCookie(w, &http.Cookie{ |