Validate access token with api call
What does this MR do and why?
This validates access to a resource by making an api request via the octokit client. If the call is successful the import continues. If an error is raised a message is returned to the user.
It also updates documentation and browser information about the scope or permission required by personal access tokens, covering both classic and fine-grained token cases
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Updated info/warning/error messages
classic token without repo or collaborator access
classic token no collaborator access
fine-grained token no collaborator access
How to set up and validate locally
- You'll need a GitHub account with some private repos that have collaborators
- Create various tokens on GitHub to test with:
- a classic token with
delete:packages
scope ("Your GitHub access token does not have the required scope or permission to import. ...") - a classic token with
repo
scope ("... Your GitHub access token does not have read access to collaborators...") - a fine-grained token with
repository:read-only
permission (("... Your GitHub access token does not have read access to collaborators...") - a classic token with
read:org
scope - should import collaborators - a fine-grained token with
administration:read-only
permission - should import collaborators
- Test via
http://gdk.test:3000/import/github/new
. You'll need to log out and log back in for each different token. See the videos above for expectations.
Related to #444618 (closed)
Edited by Carla Drago