Prefill scope for Personal Access Token creation

Problem to solve

To make it easier for folks to follow the prompt:

Tip: you can generate a Personal Access Token here https://gitlab.com/-/profile/personal_access_tokens The minimum required scopes are 'api' and 'write_repository'. ? Paste your authentication token:

We can pre-fill the scopes in the URL.

Proposal

Add the querystring to URLs.

Full implementation can be found in the following diff:

commit c66895be19b73ed5b65e8e9d682072dd1925e0d1
Author: Jamie Tanna <jamie@jamietanna.co.uk>
Date:   Sun Sep 17 20:42:13 2023 +0100

    Prefill scope for PATs

    To make it easier for folks to get a Personal Access Token provisioned,
    we can add the `scopes` querystring parameter to pre-fill the scopes in
    the UI.

diff --git README.md README.md
index 9d7d2443..4bb82e10 100644
--- README.md
+++ README.md
@@ -137,8 +137,8 @@ To authenticate your installation of `glab` with a personal access token:

 1. Get a GitLab personal access token with at least the `api`
    and `write_repository` scopes. Use the method appropriate for your instance:
-   - For GitLab.com, create one at the [Personal access tokens](https://gitlab.com/-/profile/personal_access_tokens) page.
-   - For self-managed instances, visit `https://gitlab.example.com/-/profile/personal_access_tokens`,
+   - For GitLab.com, create one at the [Personal access tokens](https://gitlab.com/-/profile/personal_access_tokens?scopes=api,write_repository) page.
+   - For self-managed instances, visit `https://gitlab.example.com/-/profile/personal_access_tokens?scopes=api,write_repository`,
      modifying `gitlab.example.com` to match the domain name of your instance.
 1. Start interactive setup: `glab auth login`
 1. Authenticate with the method appropriate for your GitLab instance:
diff --git commands/auth/login/login.go commands/auth/login/login.go
index 965ce218..ab71424b 100644
--- commands/auth/login/login.go
+++ commands/auth/login/login.go
@@ -369,7 +369,7 @@ func getAccessTokenTip(hostname string) string {
 		glHostname = glinstance.OverridableDefault()
 	}
 	return fmt.Sprintf(`
-	Tip: you can generate a Personal Access Token here https://%s/-/profile/personal_access_tokens
+	Tip: you can generate a Personal Access Token here https://%s/-/profile/personal_access_tokens?scopes=api,write_repository
 	The minimum required scopes are 'api' and 'write_repository'.`, glHostname)
 }

Further details

Links / references

Assignee Loading
Time tracking Loading