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
Community Members
Community Events
Community Groups

Invalid redirect_uri

i tried to secure mt API in .Net Core 3.1, using OAuthentication with bitbucket client-id and clientSecret  ,

i am authenticated and then  i have "Invalid redirect_uri" error

here is the associated Url:




i think that i have a probleme on "callbackPath"

------------------my code snippets---------------/////----------------------------------------

services.AddAuthentication(config =>

{ // we check cookie to confirm that we are authenticated
config.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
// when we sign in , we will deal out a cookie
config.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
// use this to check if we are allowed to do something
config.DefaultChallengeScheme = "OurServer";
}).AddCookie().AddOAuth("OurServer", config =>

config.ClientId = Configuration["OurServer:ClientId"];
config.ClientSecret = Configuration["OurServer:ClientSecret"];
config.CallbackPath = new PathString("/");
config.AuthorizationEndpoint = ""; //
config.TokenEndpoint = "";
config.SaveTokens = true;
config.Events = new OAuthEvents()
OnCreatingTicket = context =>
var accessToken = context.AccessToken;
var base64payload = accessToken.Split('.')[1];
var bytes = Convert.FromBase64String(base64payload);
var JSonpayload = Encoding.UTF8.GetString(bytes);
var claims = JsonConvert.DeserializeObject<Dictionary<string, string>>(JSonpayload);
foreach(var claim in claims)
context.Identity.AddClaim(new Claim(claim.Key, claim.Value));
return Task.CompletedTask;




Does anyone have encountered this problem or know the solution?


0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Bug Fix: Sourcetree for Windows authentication error when updating to app password

Hello Sourcetree users!!! With the recent removal of Bitbucket Cloud account passwords for app passwords (please see our Bitbucket Cloud community post for details on why we made this change for se...

61,567 views 127 27
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you