Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
42846c69
authored
Mar 20, 2026
by
Calcium-Ion
Committed by
GitHub
Mar 20, 2026
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3359 from seefs001/feature/normalize-bearer-type
fix: normalize generic oauth bearer token type
parents
64f41efc
1911520e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
oauth/generic.go
+9
-4
No files found.
oauth/generic.go
View file @
42846c69
...
...
@@ -208,10 +208,7 @@ func (p *GenericOAuthProvider) GetUserInfo(ctx context.Context, token *OAuthToke
}
// Set authorization header
tokenType
:=
token
.
TokenType
if
tokenType
==
""
{
tokenType
=
"Bearer"
}
tokenType
:=
normalizeAuthorizationTokenType
(
token
.
TokenType
)
req
.
Header
.
Set
(
"Authorization"
,
fmt
.
Sprintf
(
"%s %s"
,
tokenType
,
token
.
AccessToken
))
req
.
Header
.
Set
(
"Accept"
,
"application/json"
)
...
...
@@ -320,6 +317,14 @@ func (p *GenericOAuthProvider) GetProviderId() int {
return
p
.
config
.
Id
}
func
normalizeAuthorizationTokenType
(
tokenType
string
)
string
{
tokenType
=
strings
.
TrimSpace
(
tokenType
)
if
tokenType
==
""
||
strings
.
EqualFold
(
tokenType
,
"Bearer"
)
{
return
"Bearer"
}
return
tokenType
}
// IsGenericProvider returns true for generic providers
func
(
p
*
GenericOAuthProvider
)
IsGenericProvider
()
bool
{
return
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment