Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket OAuth2 - Grant Access button not redirecting to callback url

gioravered March 19, 2020

Hi all,

I'm trying to get my app to authorize through OAuth2.

i've set up the OAuth2 entry, received the Client Id and secret.

I've also set the callback url to something like: something://somethingElse

 

When browsing to https://bitbucket.org/site/oauth2/authorize?client_id=***CLIENT_ID****&response_type=code

 

I get the page that tells about the permission I'm giving to the app and I'm able to click the Grant Access button.

The issue is that the click doesn't redirect to the callback url. It loads for a second and stays on the same page. The access is granted (I've checked in my Bitbucket profile).

 

Any help will be appreciated.

Thanks a lot,

Giora.

1 answer

1 accepted

0 votes
Answer accepted
Barry Allen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 19, 2020

Hi there,

 

Is this mobile app or web app?

If this is mobile app, make sure that your "deep linking" is working properly.

gioravered March 20, 2020

Thanks for answering. 

This is a mobile app. But even on a laptop browser the callback url not loaded.

I've found out that when setting the scheme to be http (or https) it works fine, but I wanted to avoid using http/s (and it was possible before) to avoid other apps from responding to this intent (Android) 

 

For example this url doesn't work: bitbucket://my_app

And this does: https://my_app

 

Thanks, 

Giora. 

Barry Allen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2020

>>>For example this url doesn't work: bitbucket://my_app

Because some other app, already register this url for deep link. To troubleshoot this problem

  • so give some randomstring://my_app instead of bitbucket://my_app inside your android app and do the same in bitbucket's redirect url too.
  • Give this url directly into your device's browser. if this is working fine, we need to debug it further from our size. It is not not redirecting, it is "deep link" issue.

 

>>> I wanted to avoid using http/s (and it was possible before) to avoid other apps from responding to this intent (Android) 

Even when you use bitbucket://my_app, it is possible to use your intent from other app too. In this case there is no much different between http(s) and bitbucket://my_app.

As far as I know, it is better to use http(s) over bitbucket://my_app for deep link.

gioravered March 20, 2020

I will check again. 

For the record, I didn't use bitbucket://my_app. I've something more unique than that. 

I'll update soon. 

gioravered March 20, 2020

Hi Barry,

Checked it once again and found the issue. It was indeed an app issue with defining the url host.

For future developers: My mistake was to include the "://" in the host name defined in the activity intent filter.

 

Sorry for the hassle and thanks a lot for the help.

 

Giora.

Like Barry Allen likes this
Barry Allen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2020

Giora, Thank you for the update.

Barry Allen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2020

@gioravered , can you please mark my answer as "Best answer", since the problem is reload to "deep linking".

gioravered March 21, 2020

I thought I did.. 

Marked now. Thanks again. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events