I'm trying to create a publisher with a Personal Access Token but it fails to create it.
Error: Failed Request: Unauthorized(401) - https://app.market.visualstudio.com/_apis/gallery
Resolved the issue. The reason for returning 401 was that I didn't set the Accounts setting to all accessible accounts.
Adding a link to explain what this means as I googled this issue and landed here. No real explanation was given as how to enable this setting.
https://code.visualstudio.com/docs/tools/vscecli#_common-questions
Thanks, @amamut!
Ping @waderyan: we really need SEO on our docs.
@pjmeyer see above. Could use your help on improving SEO holistically for the site.
I'm struggling with this now, can't figure out what I'm supposed to enter as publisher for create-publisher and the docs all link in a circle 😦
Hi @Sequoia, sorry to read that! Could you get a hold of a Personal Access Token? Once you do, you can call vsce create-publisher publishername to create it. Do you see any errors?
@joaomoreno Yes I have one, what i don't know is what to enter for publishername. Is it my "Team" name? An arbitrary string? I just keep getting 401 with no additional info.
Here's my "team" URL: https://34ks.visualstudio.com/
Same here.
OS Version: Windows 10 Home 10.0.10538
VS Team Services Access Token Details:

Output:
C:\Users\Nick\Desktop\pony>vsce create-publisher npruehs
Publisher human-friendly name: (npruehs)
Personal Access Token: ****************************************************
Error: Failed Request: Unauthorized(401) -
@npruehs This issue is closed.
Are you sure you created your PAT for all accessible accounts?
A: One easy mistake to make when creating the PAT (Personal Access Token) is to not select all accessible accounts in the Accounts field dropdown (instead selecting a specific account). You should also set the Authorized Scopes to All scopes for the publish to work.
@joaomoreno this bug should be migrated to the VSCode Extension _platform/server_ repo; this is a UI bug in the server's response.
401 Unauthorized. If you are receiving this response on your own account, see faq.vscode.biz/#vsce-unauthorized
User is given some instruction on how to remedy this 👉🏼_common_👈🏼 issue with the peculiarities of the MSFT/VS permissions system that are frequently confusing to new users.
401 unauthorized
User is given no help, it appears they entered something wrong _at the command line_ (whereas in fact the issue is with server account settings). You try to fix it, checking your credentials and retrying several times, to no avail. 😿
Or perhaps the help message should come from vsce upon 401? Either way, the user should be given _some_ sort of guidance to help them handle this issue, which is a roadblock in particular for new users.
Agreed. Pushed a commit which guides users towards fixing this specific problem.
Worked like a charm. Thanks all!
👏🏼👏🏼👏🏼👍🏼 thanks!!
I get 401 here even though I set up the token for all accessible accounts. At a dead end here...
@joshjg Have you tried picking another publisher name?
@joaomoreno Yes, to no avail.
@modigrv @hamenon Some help here?
@joshjg could you give us some more info like the account name where you created the token and the publisher id you are looking to create? Might help us investigate further. If possible can you write to us at [email protected] we can have someone from the team debug the issue.
As a workaround you could create the publisher manually at http://marketplace.visualstudio.com/manage and upload the packaged vsix directly to get unblocked
So, I'm in the same situation, trying vsce create-publisher and getting a 401.
I've just published the extension using @hamenon workaround 👏
Why don't you put this workaround in the docs?
I'm afraid the workaround only allows you to create a new extension but not to update one.
What happens if I delete my extension and publish a new version? how this affects users with the extension installed?
How can I debug vsce? I've tried both vsce login and vsce create-publisher and I've got the same error (401) in both cases.
I've managed to update the extension using the very hidden option in the extension... If you point me to the GitHub repo of the marketplace I'd like to file an issue.
This is such a huge pain point to beginner extension devs. If it weren't for this issue thread, I'd be stuck.
Thanks for updating the documentation, I hope it lands soon.
@hamenon There seems to be a lot of friction over here. Is there any way vsce can get the error message from the 401 through the use of vso-node-api?
We did discover an issue with the PAT's that are issued by the VSTS Identity Service. This has now been fixed and the deployed on production. Note that only PAT's created in the last week or so are affected.
So I just hit this trying to publish my first extension. Really have no idea what "which has access to all accessible accounts" means. What should I do from here?
@geddski This is the option you're looking for:

Ah that worked. Thanks!
On Thu, Nov 17, 2016 at 6:59 PM joshjg [email protected] wrote:
@geddski https://github.com/geddski This is the option you're looking
for:
[image: screen shot 2016-11-17 at 8 57 58 pm]
https://cloud.githubusercontent.com/assets/21149010/20415795/aacee9ea-ad08-11e6-876c-63ea1c8f32ab.png—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode-vsce/issues/11#issuecomment-261427950,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAfeioU8AjYqcROxfXyY41g6sQQALm-Xks5q_QZrgaJpZM4GQJRH
.
I am trying the same but I dont have the all accessible acounts option...

i have get the same problem, and finally find the reason is "forget to change organization to all accoujnts when create token"
Well, I am using an account at work and I had to enable a PAT for "All accessible organizations", which of course is similar to the case "All accounts". But it should be noted as a possible scenario.
vsce --version
1.66.0
The message is still not helping the user😢

I installed it today via npm i -g vsce
vsce --version
1.66.0The message is still not helping the user😢
I installed it today via
npm i -g vsce
+1
vsce --version
1.66.0The message is still not helping the user😢
I installed it today via
npm i -g vsce
use vsce login and paste token is fine for me
Got the same unhelpful error message.
ERROR Failed request: (401)
% vsce --version
1.67.1
On https://dev.azure.com/$myorganization/_usersSettings/tokens, changing the scope to "All accessible organizations" fixed the 401 problem.
Select this option from the dropdown.

Thank you very much @hamenon
It was a terrible mistake, I don't understand the meaning of choice “All accessible organizations” ,That seems to be the only choice , The other option doesn't seem to make any sense.
I have lost the existing token. The person who generated the token first time is no longer with the team. How can I associate a new token from a new account to existing publisher?
I tried creating a token from new account and it says:
ERROR Access Denied: abcxyzteam needs the following permission(s) on the resource /Pxxxxx to perform this action: View user permissions on a resource
Any pointers are helpful.
I have lost the existing token. The person who generated the token first time is no longer with the team. How can I associate a new token from a new account to existing publisher?
I tried creating a token from new account and it says:
ERROR Access Denied: abcxyzteam needs the following permission(s) on the resource /Pxxxxx to perform this action: View user permissions on a resource
Any pointers are helpful.
Got the same thing. I tried to find that permission in the token list, but unlucky.
hey @maintainers pls put this in your error message or make your UI more intuitive.
Please just give us a one click oauth system. I have no clue what my publisher name is. My token isn't working. I can't figure this out. The docs go in a loop. There is no example of what "publisher" is supposed to look like in package.json. I have never in my life seen an auth flow so complicated, even on dev tooling.
At least a video or blog with screenshots would be a good step towards making this process less of a pain. Right now it sucks big time.
It's the next day and I've given up on publishing from the terminal. Guess I'm rocking the Marketplace upload dropzone from here on out.
It worked for me just when I've allowed full access option

Most helpful comment
Resolved the issue. The reason for returning 401 was that I didn't set the
Accountssetting toall accessible accounts.