-
-
Notifications
You must be signed in to change notification settings - Fork 28
Feature/authentication strategies #78
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
base: master
Are you sure you want to change the base?
Feature/authentication strategies #78
Conversation
Hey @shtelzerartem , thanks for openning this draft. I see there are many unrelated changes. It would make reviewing this so much harder. For example:
Can you please remove those? |
@MunifTanjim yes, for sure! I will probably clean the code soon, so you will be able to review it. |
d38e53a
to
bcb3cff
Compare
@MunifTanjim hey, I have tried to clear it as much as possible. |
bcb3cff
to
5d63fd0
Compare
It might be the case I'm implementing it wrong, but I'm getting an error when trying to test this. What I've done so far:
This returns the following error:
If I change the auth method to use an AppPassword does return my account information accordingly. Wonder if there's something wrong in the test script or I'm missing something right now. I guess the expected result is to start the authentication process. I wonder if there's any specific callback URL we should use like HTTPs://localhost:1234/oauth2 or whatsoever in the setup of the bitbucket OAuth consumer application. Thanks and great job! I'm really keen to see this working and report any issues. (don't have the skill-set right now to contribute in the development side) |
@Raspikabek hey, thanks for testing! Yep, there was a bug, that I have fixed in the latest commit. About callbacks. Are you talking about |
Nice! Now seems to be working! Thanks for the quick response. Related to BTW
Anyway... I guess the best approach to implement a secure login process using this library would be by using the JWT Auth and implementing the authorization process to get the JWT token from my own application (the one that requires this library) using something like this example provided by Atlassian Again thanks a million for the hard work! |
@Raspikabek thank you for another one bug! I will fix it soon. About Implicit grant new Bitbucket({
auth: {
type: 'token',
token: '<YOUR BEARER TOKEN>',
},
}) Authorization Code Grant new Bitbucket({
authStrategy: 'OAuth',
auth: {
grant_type: 'authorizationCodeGrant',
client_id: '<CLIENT ID>',
client_secret: '<CLIENT SECRET>',
code: '<CLIENT CODE>',
},
}) With JWT Auth I think, the same trick. |
- Added validation for strategies - Fixed Endpoint interface
@MunifTanjim have you had a chance to go over, it looks, like everything we went over with @Raspikabek work fine. |
src/plugins/authenticate/index.ts
Outdated
client.requestHook.before(beforeRequest.bind(null, state)) | ||
} | ||
|
||
export default authenticatePlugin |
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 is removing this plugin related to this PR?
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.
I don't think there is a need for authenticate, I moved it's logic to auth/basicAuth
.
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 is an optional plugin that is not included in the bundle by default. This is here for legacy reason. If we want to remove it, we should put a deprecation notice first.
Bitbucket's API specificaiton is troublesome enough, that introduces breaking changes frequently. I just don't want to add more to it from this library.
Eitherway, this removing this is not related to this PR at all. "If" we want to do this, this should be done in a separate PR.
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.
Ok, sounds reasonable!
81a28f5
to
9fac6f0
Compare
9fac6f0
to
e10df78
Compare
@MunifTanjim any update on this? |
Issue
Current bitbucket lib is not supporting authorization strategies for OAuth.
What I have done?
I have implemented main OAuth2 authorization methods to retrieve
access_token
.It's a draft pull request for bitbucket authStrategies. Would be happy if someone will check or test it.
https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication
Related issue #18