Repository: vscode
Issue: Unable to login using the new Fine-grained PATs, even with all open permissions
Labels: feature-request,github-authentication

<!-- Please search existing issues to avoid creating duplicates. -->

<!-- Use Help > Report Issue to prefill some of these. -->

- Extension version: v0.80.1
- VSCode Version: 1.86.1
- OS: Ubuntu-22.04 / Windows-11 / AlmaLinux-9
- Repository Clone Configuration (single repository/fork of an upstream repository): single repository (private repo on my github.com account)
- Github Product (Github.com/Github Enterprise version x.x.x): github.com
- Tested with Code-Server
- Tested inside docker containers
- Tested inside podman containers


Steps to Reproduce:

1. Create a New Fine-Grained PAT with all permissions
![image](https://github.com/microsoft/vscode-pull-request-github/assets/42283188/a1f9ccd8-69d2-447a-b2d9-148cda955ac2)
2. Login into the extension.
3. Cancel the login with device code flow.
4. Login with PAT.
5. Enter the PAT when prompted.
6. Get the error.

**Expected result:** The login should succeed.


**_Error log: On VSCode_**
 ``` 
2024-02-14 18:20:55.397 [info] Logging in for the following scopes: read:user repo user:email workflow
2024-02-14 18:20:55.403 [info] Trying device code flow... (read:user repo user:email workflow)
2024-02-14 18:20:58.381 [error] User Cancelled
2024-02-14 18:21:29.362 [info] Trying to retrieve PAT... (read:user repo user:email workflow)
2024-02-14 18:21:58.695 [info] Getting token scopes...
2024-02-14 18:21:59.077 [error] The provided token does not match the requested scopes: read:user repo user:email workflow
2024-02-14 18:21:59.078 [error] Error: No auth flow succeeded.
```

**_Error log: On Code-Server with the same versions as mentioned above._**
```
2024-02-14 18:15:28.793 [info] Logging in for the following scopes: read:user repo user:email workflow
2024-02-14 18:15:28.824 [info] Trying device code flow... (read:user repo user:email workflow)
2024-02-14 18:15:32.660 [error] User Cancelled
2024-02-14 18:15:34.181 [info] Trying to retrieve PAT... (read:user repo user:email workflow)
2024-02-14 18:15:42.359 [info] Getting token scopes...
2024-02-14 18:15:43.000 [error] The provided token does not match the requested scopes: read:user repo user:email workflow
2024-02-14 18:15:43.001 [error] Error: No auth flow succeeded.
	at a.GitHubServer.login (/usr/lib/code-server/lib/vscode/extensions/github-authentication/dist/extension.js:2:260240)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async a.GitHubAuthenticationProvider.createSession (/usr/lib/code-server/lib/vscode/extensions/github-authentication/dist/extension.js:2:256713)
```

The plugin works well with the classic token, but I couldn't figure out the scope for the fine-grained token. So I started with bare-minimum permissions on the fine-grained token and with each failure added new permissions.
I ended up with the most open permissions possible and still I was not able to log in with the fine-grained token.
I tried this on VS Code on Linux (Ubuntu and Almalinux9) and Windows-11. Furthermore, I tried this with Code-Server on Linux with containers (podman as well as docker) and without containers on Ubuntu/Almalinux9. Each time I ensured that the versions for VS Code and extension is same. Did a lot of permutation and combinations with other versions (older) of VS Code and extension but each time the issue persists when I use the new fine-grained PAT. However, each time it works when I use the old classic token. 
The error doesn't feel to be related to VS Code/Code-Server.

This issue is not breaking my workflow. It was something that I thought of trying while I was tinkering with the new fine-grained PAT's.

**Question: Is this a bug, or something that is not yet implemented, or I'm doing something wrong, or it's a classic it works on your system but not on mine case?**