this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

oauth client: move ErrCallback to types.go

+21 -21
+1 -21
atproto/auth/oauth/oauth.go
··· 21 21 22 22 var jwtExpirationDuration = 30 * time.Second 23 23 24 - // Returned by [ClientApp.ProcessCallback] if the AS signals an error in the redirect URL parameters, per rfc6749 section 4.1.2.1 25 - // 26 - // NOTE: This is untrusted data and should not be e.g. rendered to HTML without appropriate escaping 27 - type CallbackError struct { 28 - code string 29 - description string 30 - uri *syntax.URI 31 - } 32 - 33 - func (e *CallbackError) Error() string { 34 - res := "callbackError: " + e.code 35 - if e.description != "" { 36 - res += ": " + e.description 37 - } 38 - if e.uri != nil { 39 - res += " (" + e.uri.String() + ")" 40 - } 41 - return res 42 - } 43 - 44 24 // Service-level client. Used to establish and refrsh OAuth sessions, but is not itself account or session specific, and can not be used directly to make API calls on behalf of a user. 45 25 type ClientApp struct { 46 26 Client *http.Client ··· 622 602 if err == nil { 623 603 errorUri = &parsedUri 624 604 } 625 - return nil, &CallbackError{ 605 + return nil, &ErrCallback{ 626 606 code: errorCode, 627 607 description: params.Get("error_description"), 628 608 uri: errorUri,
+20
atproto/auth/oauth/types.go
··· 407 407 // Refresh token, for doing additional token requests to the auth server. 408 408 RefreshToken string `json:"refresh_token"` 409 409 } 410 + 411 + // Returned by [ClientApp.ProcessCallback] if the AS signals an error in the redirect URL parameters, per rfc6749 section 4.1.2.1 412 + // 413 + // NOTE: This is untrusted data and should not be e.g. rendered to HTML without appropriate escaping 414 + type ErrCallback struct { 415 + code string 416 + description string 417 + uri *syntax.URI 418 + } 419 + 420 + func (e *ErrCallback) Error() string { 421 + res := "callbackError: " + e.code 422 + if e.description != "" { 423 + res += ": " + e.description 424 + } 425 + if e.uri != nil { 426 + res += " (" + e.uri.String() + ")" 427 + } 428 + return res 429 + }