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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,576
Community Members
 
Community Events
176
Community Groups

How to specify custom callback url on authorization

I am trying to implement OAuth2. I have followed this guide:

https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/

It says that I can include the callback url per request, but I cannot seem to find what the parameter is called to allow me to do this. Can you please point me to some documentation that can clear up how to specify a different callback url, as I cannot find any

2 answers

1 accepted

0 votes
Answer accepted

The property name is redirect_uri

Hi @Ruan Robson ,

Did you manage to get this to work? I've set my callback url in the OAuth consumer to http://localhost:8080/callback but whenever I try to auth with 

https://bitbucket.org/site/oauth2/authorize?client_id=xxx&response_type=code&redirect_uri=http://localhost:8080/callback/foo then in the callback, when requesting the access token, I get an error 'redirect_uri does not match'.
In fact it still fails if I set the redirect_uri parameter to exactly what I've configured in the consumer.
Many thanks,
Andy

Hi Andy,

 

My setup is as follows:

 

Button with url:

Then in my code (That gets executed on callback/foo) I have a http request with the following details:


Request Payload:
{
"grant_type": "authorization_code",
"code": "code from query string",
}
Headers:
'Content-Type': 'application/x-www-form-urlencoded'
Auth for this call uses the client id and secret.

I hope this info helps.

Aaaah, thank you so much!

The `redirect_uri` parameter needs to be on both the request for the code and the request for the token! I thought the error was about it not matching the url stored against the consumer in the workspace settings.

Strange that the documentation is so sparse here. I'd read the same page that you'd originally linked to which said you should be able to append to the callback url path but gave no indication how.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events