Skip to content

Validate access token by checking (and caching) GitLab user's data

Tom Quirk requested to merge assigned-issue-list into master

What does this MR do?

Validates user's access token by requesting GET /user from the GitLab API - if this doesn't fail and we get legitimate user data, then we can deem the access token valid. When access token is deemed valid, we save the access token in Figma's local storage, and push the user to the Upload Selection screen.

When the plugin first loads, the high-level execution steps are as follows:

  1. Plugin window appears
  2. (new) Figma renders splash screen (with GitLab logo)
  3. Figma sends the Vue app the access token (which may be null) it has stored (via the mitt event bus)
  4. When Vue app receives access token, we do request to /user. If valid, push user to Upload selection screen. If invalid, prompt user to set new access token.

Demo:

MVC-login-validation

A few other fixes/improvements:

  • Create a Figma loading icon component and use where appropriate
  • Create files for different parts of the previous apollo_client.js for easier readability (and to use some parts in tests)
  • Fix version of figma-plugin-ds to 0.1.8
  • Add integration tests for login page using mock-apollo-client

Closes #33 (closed) Part of work towards #2 (closed)

Checklist

  • Generated new gitlab_figma_plugin_dist.zip (npm run pkg) file if changes have been made to src/
  • Added tests for new functionality
Edited by 🤖 GitLab Bot 🤖

Merge request reports