Skip to content
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

Allow using Personal Access Tokens to access GitHub data #107

Open
dtinth opened this issue Apr 27, 2023 · 0 comments
Open

Allow using Personal Access Tokens to access GitHub data #107

dtinth opened this issue Apr 27, 2023 · 0 comments

Comments

@dtinth
Copy link
Member

dtinth commented Apr 27, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant