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
Commit
894ddf3f
authored
Jul 28, 2025
by
ZhengJin
Committed by
GitHub
Jul 28, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update api.js
parent
e0d9a419
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
web/src/helpers/api.js
+8
-6
No files found.
web/src/helpers/api.js
View file @
894ddf3f
...
...
@@ -215,14 +215,16 @@ export async function getOAuthState() {
export
async
function
onOIDCClicked
(
auth_url
,
client_id
,
openInNewTab
=
false
)
{
const
state
=
await
getOAuthState
();
if
(
!
state
)
return
;
const
redirect_uri
=
`
${
window
.
location
.
origin
}
/oauth/oidc`
;
const
response_type
=
'code'
;
const
scope
=
'openid profile email'
;
const
url
=
`
${
auth_url
}
?client_id=
${
client_id
}
&redirect_uri=
${
redirect_uri
}
&response_type=
${
response_type
}
&scope=
${
scope
}
&state=
${
state
}
`
;
const
url
=
new
URL
(
auth_url
);
url
.
searchParams
.
set
(
'client_id'
,
client_id
);
url
.
searchParams
.
set
(
'redirect_uri'
,
`
${
window
.
location
.
origin
}
/oauth/oidc`
);
url
.
searchParams
.
set
(
'response_type'
,
'code'
);
url
.
searchParams
.
set
(
'scope'
,
'openid profile email'
);
url
.
searchParams
.
set
(
'state'
,
state
);
if
(
openInNewTab
)
{
window
.
open
(
url
);
window
.
open
(
url
.
toString
(),
'_blank'
);
}
else
{
window
.
location
.
href
=
url
;
window
.
location
.
href
=
url
.
toString
()
;
}
}
...
...
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