fix(auth login): encode scopes for oauth url
Description
As per the 5th line in the output of #7289 (closed), the spaces in the scopes
were not being escaped, e.g:
Failed opening a browser at https://gitlab.com/oauth/authorize?client_id=XXX&redirect_uri=http://localhost:7171/auth/redirect&response_type=code&state=XXX&scope=openid profile read_user write_repository api&code_challenge=XXX&code_challenge_method=S256
This causes issues if a user clicks this url from the terminal as only https://gitlab.com/oauth/authorize?client_id=XXX&redirect_uri=http://localhost:7171/auth/redirect&response_type=code&state=XXX&scope=openid
would be used, dropping the rest of the URL. Some more context is here: #7289 (comment 1554177569)
With this MR the spaces should be replaced by +
:
Failed opening a browser at https://gitlab.com/oauth/authorize?client_id=XXX&redirect_uri=http://localhost:7171/auth/redirect&response_type=code&state=XXX&scope=openid+profile+read_user+write_repository+api&code_challenge=XXX&code_challenge_method=S256
Related Issues
Related to #7289 (closed)
How has this been tested?
Removing config ~/.config/glab-cli/config.yml
glab auth login
-> web
By ensuring the URL opened by glab
and the URL in the terminal when the browser failed to open is equivalent.
Screenshots (if appropriate):
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change) -
Documentation -
Chore (Related to CI or Packaging to platforms) -
Test gap