-
Notifications
You must be signed in to change notification settings - Fork 12
Make the --github-auth flag work for extensions #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This are the kind of nuance things where I think, "How did Asher figure this out? 😅"
Nice work though! I appreciate the set of comments and how small this change is. Can't wait for patches.
* | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah it kind of was intentional in that I did see my editor had done this but for some reason it did not occur to me to skip committing this. Gonna remove to not needlessly increase the patch size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually looks like it is our own comment so I will go ahead and leave it.
* read:user. | ||
* @author coder | ||
*/ | ||
scopes: [['read:user', 'user:email', 'repo'], ['user:email'], ['repo']] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ How come they have to be duplicated like this? I would think it would be enough to do:
scopes: [['read:user', 'user:email', 'repo'], ['user:email'], ['repo']] | |
scopes: [['read:user'], ['user:email'], ['repo']] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I thought so too but the scopes have to match exactly. So if an extension wants ['repo']
but the token offers both ['repo', 'read:user']
then it will not match.
You can see here they do a strict equals on the scopes array:
vscode/extensions/github-authentication/src/github.ts
Lines 73 to 75 in 676edaa
const finalSessions = scopes | |
? sessions.filter(session => arrayEquals([...session.scopes].sort(), scopes.sort())) | |
: sessions; |
It does feel like a bug so maybe we should patch this instead but idk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AH...that make sense. Thanks for explaining. When we get to patches, I will see if it's a bug and we can raise upstream.
I was hoping the existing
--github-auth
flag would just work but it did not. Extensions seems to use a completely different credential entry for some reason so I have it inserting one that matches. I tested the pull request extension and GitLens.There will be a companion PR shortly to make this work with code-server.
I am very unsure as to whether this is the right way to handle it.