Skip to content
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

Token is granted for [YouTrack] and can't be used for 0-0-0-0-0 #116

Open
dse-copsfs opened this issue Feb 1, 2022 · 3 comments
Open

Token is granted for [YouTrack] and can't be used for 0-0-0-0-0 #116

dse-copsfs opened this issue Feb 1, 2022 · 3 comments
Assignees

Comments

@dse-copsfs
Copy link

Expected behavior

Get a list of projects.

Actual behavior

An exception

Response	"{\"error\":\"invalid_token\",\"error_code\":401,\"error_description\":\"Token is granted for [YouTrack] and can't be used for 0-0-0-0-0\",\"error_developer_message\":\"Token is granted for [YouTrack] and can't be used for 0-0-0-0-0\"}"

Steps to reproduce the behavior

  1. Create a new permanent token (scope: YouTrack) for some user of a cloud version (our instance is: https://cops-cz.myjetbrains.com/youtrack)
  2. YouTrackSharp nuget package v. 2021.3.6
  3. Following https://github.com/JetBrains/YouTrackSharp, we tried:
var connection = new BearerTokenConnection("https://cops-cz.myjetbrains.com/youtrack/", "perm:abcdefgh");
var projectsService = connection.CreateProjectsService();
var projects = await projectsService.GetAccessibleProjects();

Please advice us what is the issue.

@rekolobov
Copy link
Member

rekolobov commented Feb 1, 2022

Hi, please create a permanent token while selecting both YouTrack and YouTrack Administration scopes
token

@rekolobov rekolobov self-assigned this Feb 1, 2022
@dse-copsfs
Copy link
Author

Hello, thanks, now it works. I have one following question, please. Our use case is read-only. No manipulation with users/projects. In this case, is the YouTrack Administration scope needed too?

@kim-lindhard
Copy link

You need both the YouTrack and the YouTrack Administration scopes in the Permanent Token

I tried creating a Permanent Token with only the YouTrack scope and got the 401 error code
I tried creating a Permanent Token with only the YouTrack Administration scope and got the 401 error code

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

3 participants