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

Use space character as scope separator #7

Merged
merged 2 commits into from
May 3, 2018
Merged

Use space character as scope separator #7

merged 2 commits into from
May 3, 2018

Conversation

gvso
Copy link
Contributor

@gvso gvso commented Apr 14, 2018

The default scope separator in oauth2-client is the comma (,), but Bitbucket seems to use spaces.

I don't have any links/official docs to support this claim, but commas didn't work for me while spaces did work.

@stevenmaguire
Copy link
Owner

@gvso thanks for looking into this. I am curious why the package has gone so long without running into this issue...

I did try to find some documentation and was unsuccessful. Do you think you can reach out to Bitbucket and have them confirm the changes? If so, I am happy to merge after the tests are updated to support this change, which is why the build is failing.

@gvso
Copy link
Contributor Author

gvso commented May 3, 2018

I created a ticket but haven't got any updates yet.

I updated the test file this time (P.s: wrong commit message).

I'll let you know when I get a reply. Meanwhile, you might want to try requesting multiple scopes using comma and space to see the difference.

@gvso
Copy link
Contributor Author

gvso commented May 3, 2018

I just got a reply from Bitbucket:

Thank you for reaching out to Atlassian Support.

We've checked and tested the Bitbucket API on our end. Seems that the API is indeed returns the "scopes" field's value with space separator.

{
"access_token": "===ACCESS_TOKEN===",
"scopes": "pipeline:variable webhook snippet:write wiki issue:write pullrequest:write repository:delete repository:admin project:write team:write account:write",
"expires_in": 3600,
"refresh_token": "===REFRESH_TOKEN===",
"token_type": "bearer"
}

For this, we can confirm that it is indeed Bitbucket Cloud's API is returning space separator when it comes to "scopes" field.

The best we can suggest for now is to parse it as a space separator.

@stevenmaguire
Copy link
Owner

@gvso Awesome work! Thanks for running that down. Merging and will cut a new release.

@stevenmaguire stevenmaguire merged commit 05b2da5 into stevenmaguire:master May 3, 2018
@stevenmaguire
Copy link
Owner

Version 3.0.0 has been cut.

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

Successfully merging this pull request may close these issues.

2 participants