Validate access token by checking (and caching) GitLab user's data
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:
- Plugin window appears
- (new) Figma renders splash screen (with GitLab logo)
- Figma sends the Vue app the access token (which may be
null
) it has stored (via themitt
event bus) - When Vue app receives access token, we do request to
/user
. If valid, push user toUpload selection
screen. If invalid, prompt user to set new access token.
Demo:
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 usingmock-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 tosrc/
-
Added tests for new functionality
Edited by 🤖 GitLab Bot 🤖