jgrandja / oauth2login-demo

27 stars 16 forks source link

Trying to connect to BitBucket and having issues #1

Open reflexdemon opened 5 years ago

reflexdemon commented 5 years ago

I know this is not the spring securities main support channel. I was watching your video and was able to get the linked-in integration working. Thanks a lot for the assistance on that.

I am still exploring the integration with bitbucket.org (https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication) I am unable to figure out the user-info endpoint for bitbucket and thought if you can help me in getting the info.

Here is my example application.yml

security:
    oauth2:
      client:
        registration:
          google:
            client-id: ${GOOGLE_CLIENT_ID}
            client-secret: ${GOOGLE_SECRET}
          github:
            client-id: ${GITHUB_CLIENT_ID}
            client-secret: ${GITHUB_SECRET}
          bitbucket:
            client-id: ${BIT_BUCKET_CLIENT_ID}
            client-secret: ${BIT_BUCKET_SECRET}
            client-authentication-method: post
            authorization-grant-type: authorization_code
            redirect-uri-template: "{baseUrl}/login/oauth2/code/{registrationId}"
            client-name: BitBucket
          linkedin:
            client-id: ${LINKEDIN_CLIENT_ID}
            client-secret: ${LINKEDIN_SECRET}
            scope: r_basicprofile, r_emailaddress
            client-authentication-method: post
            authorization-grant-type: implicit
            redirect-uri-template: "{baseUrl}/login/oauth2/code/{registrationId}"
            client-name: Linkedin
        provider:
          bitbucket:
            authorization-uri: https://bitbucket.org/site/oauth2/authorize
            token-uri: https://bitbucket.org/site/oauth2/access_token
            user-info-uri: https://bitbucket.org/user/repo.git
            user-name-attribute: id
          linkedin:
            authorization-uri: https://www.linkedin.com/oauth/v2/authorization
            token-uri: https://www.linkedin.com/oauth/v2/accessToken
            user-info-uri: https://api.linkedin.com/v1/people/~?format=json
            user-name-attribute: id

Any assistance on this will be of great help.

jgrandja commented 5 years ago

It looks like the UserInfo endpoint is here https://developer.atlassian.com/bitbucket/api/2/reference/resource/user

You will also need to configure scope: account, as per the required scopes for /2.0/user.