We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 66a94d4 + e9b53d4 commit df3f538Copy full SHA for df3f538
ginoauth2.go
@@ -107,12 +107,11 @@ func extractToken(r *http.Request) (*oauth2.Token, error) {
107
return nil, errors.New("no authorization header")
108
}
109
110
- th := strings.Split(hdr, " ")
111
- if len(th) != 2 {
112
- return nil, errors.New("incomplete authorization header")
+ typ, token, ok := strings.Cut(hdr, " ")
+ if !ok {
+ return nil, errors.New("invalid authorization header")
113
114
-
115
- return &oauth2.Token{AccessToken: th[1], TokenType: th[0]}, nil
+ return &oauth2.Token{AccessToken: token, TokenType: typ}, nil
116
117
118
func requestAuthInfo(o Options, t *oauth2.Token) ([]byte, error) {
0 commit comments