mirror of
https://github.com/coder/coder.git
synced 2026-09-24 06:47:27 +08:00
fix: correct github oauth2 callback url (#9052)
* fix: correct github oauth2 callback url
This commit is contained in:
@@ -136,6 +136,7 @@ test("change login type to OIDC", async () => {
|
||||
|
||||
jest.spyOn(SSO, "redirectToOIDCAuth").mockImplementation(() => {
|
||||
// Does a noop
|
||||
return ""
|
||||
})
|
||||
|
||||
const ssoSection = screen.getByTestId("sso-section")
|
||||
|
||||
@@ -30,7 +30,16 @@ export const redirectToOIDCAuth = (
|
||||
stateString: string,
|
||||
redirectTo: string,
|
||||
) => {
|
||||
window.location.href = `/api/v2/users/${toType}/callback?oidc_merge_state=${stateString}&redirect=${redirectTo}`
|
||||
switch (toType) {
|
||||
case "github":
|
||||
window.location.href = `/api/v2/users/oauth2/github/callback?oidc_merge_state=${stateString}&redirect=${redirectTo}`
|
||||
break
|
||||
case "oidc":
|
||||
window.location.href = `/api/v2/users/oidc/callback?oidc_merge_state=${stateString}&redirect=${redirectTo}`
|
||||
break
|
||||
default:
|
||||
throw new Error(`Unknown login type ${toType}`)
|
||||
}
|
||||
}
|
||||
|
||||
export const useSingleSignOnSection = () => {
|
||||
|
||||
Reference in New Issue
Block a user