Skip to content

Allow using Personal Access Tokens to access GitHub data #107

Open
@dtinth

Description

@dtinth

Right now authentication with GitHub is done via GitHub Apps, which requires an elaborate setup using private keys and stuff. Creating a GitHub App requires a lot of privilege on the organization. This makes it hard for people to contribute to the backend.

Task — Add ability to use Personal Access Token to auth with GitHub.

Recommended starting points

  • export interface GitHubUserConfig {
    auth: GitHubAppAuthUserConfig
    repo: string
    branch: string
    }
    export interface GitHubAppAuthUserConfig {
    appId: number
    privateKey: string
    }

    • Change auth: GitHubAppAuthUserConfig | GitHubPersonalAccessTokenAuthUserConfig
    • Add GitHubPersonalAccessTokenAuthUserConfig interface with token: string
  • export const config = {
    testing: Env(
    z.object({
    BACKEND: z.enum(['production', 'real']).default('real'),
    }),
    ),
    credentials: Env(
    z.object({
    GH_APP_PRIVATE_KEY: z.string(),
    MONGO_URI: z.string(),
    }),
    ),
    }

    • Update credentials schema so that one of GH_APP_PRIVATE_KEY or GH_TOKEN is provided.

If you use gh CLI, you can use gh auth status --show-token to get your own GitHub token. Alternatively you can go to https://github.com/settings/tokens to create new token.

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