🙌 OpenHands: AI-Driven Development
Fix issue #5162: docs: Improve GitHub token setup documentation in UI… (#5491)
Rohit Malhotracfe222e1d522
diff --git a/docs/modules/usage/how-to/gui-mode.md b/docs/modules/usage/how-to/gui-mode.mdindex df5a070c01..f32e1acfe6 100644--- a/docs/modules/usage/how-to/gui-mode.md+++ b/docs/modules/usage/how-to/gui-mode.md@@ -23,10 +23,75 @@ OpenHands provides a user-friendly Graphical User Interface (GUI) mode for interOpenHands automatically exports a `GITHUB_TOKEN` to the shell environment if it is available. This can happen in two ways:-1. Locally (OSS): The user directly inputs their GitHub token.-2. Online (SaaS): The token is obtained through GitHub OAuth authentication.--When you reach the `/app` route, the app checks if a token is present. If it finds one, it sets it in the environment for the agent to use.+1. **Locally (OSS)**: The user directly inputs their GitHub token+2. **Online (SaaS)**: The token is obtained through GitHub OAuth authentication++#### Setting Up a Local GitHub Token++1. **Generate a Personal Access Token (PAT)**:+ - Go to GitHub Settings > Developer Settings > Personal Access Tokens > Tokens (classic)+ - Click "Generate new token (classic)"+ - Required scopes:+ - `repo` (Full control of private repositories)+ - `workflow` (Update GitHub Action workflows)+ - `read:org` (Read organization data)++2. **Enter Token in OpenHands**:+ - Click the Settings button (gear icon) in the top right+ - Navigate to the "GitHub" section+ - Paste your token in the "GitHub Token" field+ - Click "Save" to apply the changes++#### Organizational Token Policies++If you're working with organizational repositories, additional setup may be required:++1. **Check Organization Requirements**:+ - Organization admins may enforce specific token policies+ - Some organizations require tokens to be created with SSO enabled+ - Review your organization's [token policy settings](https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization)++2. **Verify Organization Access**:+ - Go to your token settings on GitHub+ - Look for the organization under "Organization access"+ - If required, click "Enable SSO" next to your organization+ - Complete the SSO authorization process++#### OAuth Authentication (Online Mode)++When using OpenHands in online mode, the GitHub OAuth flow:++1. Requests the following permissions:+ - Repository access (read/write)+ - Workflow management+ - Organization read access++2. Authentication steps:+ - Click "Sign in with GitHub" when prompted+ - Review the requested permissions+ - Authorize OpenHands to access your GitHub account+ - If using an organization, authorize organization access if prompted++#### Troubleshooting++Common issues and solutions:++1. **Token Not Recognized**:+ - Ensure the token is properly saved in settings+ - Check that the token hasn't expired+ - Verify the token has the required scopes+ - Try regenerating the token++2. **Organization Access Denied**:+ - Check if SSO is required but not enabled+ - Verify organization membership+ - Contact organization admin if token policies are blocking access++3. **Verifying Token Works**:+ - The app will show a green checkmark if the token is valid+ - Try accessing a repository to confirm permissions+ - Check the browser console for any error messages+ - Use the "Test Connection" button in settings if available### Advanced Settings