Skip to content

Fix Bitbucket Cloud Importer

What does this MR do and why?

This MR fixes currently broken Bitbucket Cloud importer. The options hash we pass in that specify correct auth/token urls was not symbolized, resulting in OAuth2 Client to use default settings, instead of the correct ones. OmniAuth::Strategies::Bitbucket.default_options[:client_options].deep_symbolize_keys doesn't symbolize keys (even though I imagine it should), probably because the returned value is not a Hash, but OmniAuth::Strategy::Options. This is why authorize_url is pointing to oauth/authorize instead of what we've set in lib/omni_auth/strategies/bitbucket.rb:14.

22] pry(main)> OmniAuth::Strategies::Bitbucket.default_options[:client_options].class
=> OmniAuth::Strategy::Options
[23] pry(main)> OmniAuth::Strategies::Bitbucket.default_options[:client_options].deep_symbolize_keys
=> {"site"=>"https://bitbucket.org", "authorize_url"=>"https://bitbucket.org/site/oauth2/authorize", "token_url"=>"https://bitbucket.org/site/oauth2/access_token"}
[24] pry(main)> OmniAuth::Strategies::Bitbucket.default_options[:client_options].to_h.deep_symbolize_keys
=> {:site=>"https://bitbucket.org", :authorize_url=>"https://bitbucket.org/site/oauth2/authorize", :token_url=>"https://bitbucket.org/site/oauth2/access_token"}

Mentions #416102 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
image image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by George Koltsov

Merge request reports