Invalid redirect_uri

Hello ,

I use the stack netlify / bitbucket / hugo
and I am trying to set netlifyCMS without success.

I worked on the published version of netlify site :
in my browser I enter : https://mysite/admin
I am invited to log in to bitbucket
I tried login / password and Google account log in both .
then I got an “Invalid redirect_uri” after login to bitbucket .

I just checked the configuration , and everything is in line with the docs
I put a callback url as https://api.netlify.com/auth/done in bitbucket oauth consumer configuration
I configured static/admin/config.yml with :
auth_type: implicit
app_id: mykey

I also have a static/admin/index.html which sources a js script at https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js

On netlify Acces Control I added Bitbucket provider with KEY / SECRET given by BitBucket oAuth Consumer …

What else can be done

Any help would be very much appreciated , thanks !

Hi, can you share the site that you’re having trouble with so I can take a look? also, are you an owner on the repo that’s linked?

If you’re using implicit auth, you won’t need to set up access control with Netlify at all - implicit auth allows you to authenticate direct with Bitbucket from your browser. I see the issue on the Atlassian community and it seems like everyone started having this problem in July, curious if something changed on Bitbucket’s end, as it doesn’t look like the related code in the CMS changed in the last two years.

Is this only happening on localhost or in production as well?

Hey Marc, the callback URL should be the address of your site and not https://api.netlify.com/auth/done when using implicit auth.
I opened an issue to improve the docs for Bitbucket here.

Hi , I try a repost in the right queue ! I am ok for sharing , can you give me an email for it.
tks

Hi , I already followed up your suggestion
But I keep getting the same result with callback url linked to
mysite/admin

get a bitbucket login button , then when click , send directly to invalid redirect url page ,
I also to log out of bitbucket ,
then I am reasked to auth on bitbucket , … when done again that redirect invalid message !

tks for your support

Hi Erquhart,
should I remove any wrong configuration somewhere that it could solve the issue ?
tks

I have this example repo: https://bitbucket.org/erezro/gatsby-netlify-cms-aws deployed here: https://hopeful-mahavira-31fd1d.netlify.com/admin if that helps (or you want to compare configs).

My callback URL is set to https://hopeful-mahavira-31fd1d.netlify.com/admin

1 Like

Hi all,

thank for your support ,
finally I got a success auth, …
what I did ,
I removed app/secret from bitbucket and renew a new one ,
I added www prefix to redirect url

I honestly don’t know what was wrong … now it works .
Thanks evreybody to pay attention to my issue.

Hi all ,
one last info,

redirect only works with the published site,
not working with localhost

But I dont mind this too much
Regards