Skip to content

vsce create-publisher returns 401 #11

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

Closed
SamVerschueren opened this issue Oct 16, 2015 · 51 comments
Closed

vsce create-publisher returns 401 #11

SamVerschueren opened this issue Oct 16, 2015 · 51 comments

Comments

@SamVerschueren
Copy link

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

@SamVerschueren
Copy link
Author

Resolved the issue. The reason for returning 401 was that I didn't set the Accounts setting to all accessible accounts.

@amamut
Copy link

amamut commented Feb 24, 2016

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

@joaomoreno
Copy link
Member

Thanks, @amamut!

Ping @waderyan: we really need SEO on our docs.

@waderyan
Copy link

@pjmeyer see above. Could use your help on improving SEO holistically for the site.

@Sequoia
Copy link

Sequoia commented Jun 23, 2016

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 😦

@joaomoreno
Copy link
Member

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?

@Sequoia
Copy link

Sequoia commented Jun 23, 2016

@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.

@Sequoia
Copy link

Sequoia commented Jun 23, 2016

Here's my "team" URL: https://34ks.visualstudio.com/

@npruehs
Copy link

npruehs commented Jul 24, 2016

Same here.

OS Version: Windows 10 Home 10.0.10538

VS Team Services Access Token Details:

vsteamservices

Output:

C:\Users\Nick\Desktop\pony>vsce create-publisher npruehs
Publisher human-friendly name: (npruehs)
Personal Access Token: ****************************************************

Error: Failed Request: Unauthorized(401) -

@joaomoreno
Copy link
Member

@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.

@Sequoia
Copy link

Sequoia commented Jul 25, 2016

@joaomoreno this bug should be migrated to the VSCode Extension platform/server repo; this is a UI bug in the server's response.

Expected

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.

Actual

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. 😿

@Sequoia
Copy link

Sequoia commented Jul 25, 2016

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.

@joaomoreno
Copy link
Member

Agreed. Pushed a commit which guides users towards fixing this specific problem.

@npruehs
Copy link

npruehs commented Jul 25, 2016

Worked like a charm. Thanks all!

@Sequoia
Copy link

Sequoia commented Jul 26, 2016

👏🏼👏🏼👏🏼👍🏼 thanks!!

@joshjg
Copy link

joshjg commented Nov 9, 2016

I get 401 here even though I set up the token for all accessible accounts. At a dead end here...

@joaomoreno
Copy link
Member

@joshjg Have you tried picking another publisher name?

@joshjg
Copy link

joshjg commented Nov 10, 2016

@joaomoreno Yes, to no avail.

@joaomoreno
Copy link
Member

@modigrv @hamenon Some help here?

@hamenon
Copy link

hamenon commented Nov 10, 2016

@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

@ipedrazas
Copy link

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?

@joaomoreno
Copy link
Member

Added to the docs: microsoft/vscode-docs@5fad3ce

@ipedrazas
Copy link

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.

@ipedrazas
Copy link

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.

@andradei
Copy link

andradei commented Nov 13, 2016

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.

@joaomoreno
Copy link
Member

@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?

@hamenon
Copy link

hamenon commented Nov 15, 2016

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.

  1. Existing users with Old PAT's (over a week old) can continue using them
  2. Existing users who created new PAT's in the last week need to generate new PAT's
  3. New users trying to create publishers can generate PAT now and get going.

@geddski
Copy link

geddski commented Nov 18, 2016

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?

@joshjg
Copy link

joshjg commented Nov 18, 2016

@geddski This is the option you're looking for:
screen shot 2016-11-17 at 8 57 58 pm

@geddski
Copy link

geddski commented Nov 18, 2016

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
#11 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAfeioU8AjYqcROxfXyY41g6sQQALm-Xks5q_QZrgaJpZM4GQJRH
.

@AvraamMavridis
Copy link

I am trying the same but I dont have the all accessible acounts option...

screen shot 2018-07-31 at 21 48 09

@webjohnjiang
Copy link

webjohnjiang commented Dec 18, 2018

i have get the same problem, and finally find the reason is "forget to change organization to all accoujnts when create token"

@toreaurstad
Copy link

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.

@guitartsword
Copy link

guitartsword commented Jul 23, 2019

vsce --version
1.66.0

The message is still not helping the user😢
image

I installed it today via npm i -g vsce

@zhohon
Copy link

zhohon commented Jul 29, 2019

vsce --version
1.66.0

The message is still not helping the user😢
image

I installed it today via npm i -g vsce

+1

@creaink
Copy link

creaink commented Sep 9, 2019

vsce --version
1.66.0

The message is still not helping the user😢
image

I installed it today via npm i -g vsce

use vsce login and paste token is fine for me

@MaskRay
Copy link

MaskRay commented Oct 15, 2019

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.

@syyam
Copy link

syyam commented Nov 17, 2019

Select this option from the dropdown.
image

@erlangparasu
Copy link

Thank you very much @hamenon

@vsTianhao
Copy link

vsTianhao commented Apr 21, 2020

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.

@ngarg-panw
Copy link

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.

@teerasej
Copy link

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.

@swyxio
Copy link

swyxio commented Jul 22, 2020

hey @maintainers pls put this in your error message or make your UI more intuitive.

@lukepighetti
Copy link

lukepighetti commented Apr 4, 2021

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.

@andradei
Copy link

andradei commented Apr 5, 2021

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.

@lukepighetti
Copy link

lukepighetti commented Apr 5, 2021

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.

@wtakayama-chwy
Copy link

It worked for me just when I've allowed full access option
image

@AnishMandal939
Copy link

vsce publish
ERROR Specified part does not exist in the package.

Geting error while publishing other all steps works well

@erlangparasu
Copy link

erlangparasu commented Feb 12, 2022

@geddski This is the option you're looking for: screen shot 2016-11-17 at 8 57 58 pm

All accessible organizations
thanks it works

@wwdok
Copy link

wwdok commented Feb 14, 2022

Now it should select All accessible organizations:
image

@bennycode
Copy link

Here is how I solved the 401 error in order to publish VS Code extensions using a GitHub Actions workflow:

  1. I set "Organiation" to "All accessible organizations" for my Personal Access Token (PAT)
  2. I used a custom defined scope of type "Marketplace: Manage"
  3. I set the expiry date to the future
  4. I created a GitHub Repository secret with the name of VSCE_PAT (as it is the default env variable used when publishing)
  5. I created the following workflow commands:
- name: 'Install dependencies'
  run: |
    yarn global add @vscode/vsce
    yarn install
- name: 'Authenticate'
  run: |
    git config --global user.email "${{ secrets.MY_GITHUB_EMAIL }}"
    git config --global user.name "Benny Neugebauer"
- name: 'Publish VS Code extension'
  env:
    VSCE_PAT: ${{ secrets.VSCE_PAT }}
  run: |
    vsce publish patch

I added a "postversion" script to my "package.json" file to push the version update also to my GitHub repository:

"scripts": {
  "postversion": "git push origin main && git push origin --tags"
}

Full version here: https://github.com/bennycode/sort-everything/blob/v1.3.3/.github/workflows/publish-extension.yml

Hope this helps! ✌️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests