Skip to content

Validate access token with api call

Carla Drago requested to merge 444618-validate-access into master

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

Screenshot_2024-03-25_at_11.18.54

Screenshot_2024-03-25_at_13.34.57

Screenshot_2024-03-25_at_11.20.47

Screenshot_2024-03-22_at_10.36.51

classic token without repo or collaborator access

no-access

classic token no collaborator access

classic-no-collab-access

fine-grained token no collaborator access

fine-grained-no-collab-access

How to set up and validate locally

  1. You'll need a GitHub account with some private repos that have collaborators
  2. 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
  1. 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

Merge request reports