Skip to content

Support setting redirect-uri for GitHub OAuth #8714

@matifali

Description

@matifali

Context

GitHub allows specifying redirect_uri to changes the redirect uri if its a subpath or subdomain of the callback URL.
We already have.

coder:
  env:
    - name: CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS
      value: true
    - name: CODER_OAUTH2_GITHUB_ALLOWED_ORGS
      value: "your-org"
    - name: CODER_OAUTH2_GITHUB_CLIENT_ID
      value: "533...des"
    - name: CODER_OAUTH2_GITHUB_CLIENT_SECRET
      value: "G0CSP...7qSM"
+   - name: CODER_OAUTH2_GITHUB_REDIRECT_URI
+     value: https://SUBDOMAIN.coder.example.com  # assuming coder.eaxmple.com/gitauth/github/callback as callback URL set in OAUTH app.
    - name: CODER_OAUTH2_GITHUB_ALLOW_EVERYONE
      value: false

This will allow using the same GitHub OAuth app across multiple Coder deployments. e.g
Deployment 1: https://datascience.coder.example.com
Deployment 2: https://frontend.coder.example.com
etc.

Suggestions

This can be done by using a condition here. If the value of redirect_uri is set, we can modify the below line to use that.

authRedirect, err := accessURL.Parse(fmt.Sprintf("/gitauth/%s/callback", entry.ID))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy