Skip to content

feat: Add GitHub OAuth #1050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 23, 2022
Prev Previous commit
Next Next commit
Fix authmethods in test
  • Loading branch information
kylecarbs committed Apr 17, 2022
commit db07849bec88b632a422d38e347989405852925c
4 changes: 2 additions & 2 deletions coderd/userauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ func (api *api) userOAuth2Github(rw http.ResponseWriter, r *http.Request) {
}

var organizationID uuid.UUID
organizations, err := api.Database.GetOrganizations(r.Context())
if err == nil {
organizations, _ := api.Database.GetOrganizations(r.Context())
if len(organizations) > 0 {
// Add the user to the first organization. Once multi-organization
// support is added, we should enable a configuration map of user
// email to organization.
Expand Down
4 changes: 2 additions & 2 deletions site/src/pages/login.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("SignInPage", () => {
)
// only leave password auth enabled by default
server.use(
rest.get("/api/v2/users/auth", (req, res, ctx) => {
rest.get("/api/v2/users/authmethods", (req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
Expand Down Expand Up @@ -66,7 +66,7 @@ describe("SignInPage", () => {
it("shows github authentication when enabled", async () => {
// Given
server.use(
rest.get("/api/v2/users/auth", async (req, res, ctx) => {
rest.get("/api/v2/users/authmethods", async (req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
Expand Down