I have some blazor project and I want to be able to post advertisement for my olx account.
Here is documentation:https://developer.olx.pl/api/doc
So I have in Program.cs:
builder.Services.AddAuthentication(options =>{ options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;}).AddCookie(o =>{ o.LoginPath = new PathString("/login"); o.LogoutPath = new PathString("/logout");}).AddOAuth("OLX", options =>{ options.ClientId = "my_client_id"; options.ClientSecret = "MySecreet"; options.CallbackPath = new PathString("/signin-olx"); options.AuthorizationEndpoint = "https://www.olx.pl/oauth/authorize"; options.TokenEndpoint = "https://www.olx.pl/api/open/oauth/token"; options.Scope.Add("v2"); options.Scope.Add("read"); options.Scope.Add("write"); options.SaveTokens = true; options.Events = new OAuthEvents { OnTicketReceived = async context => { var accessToken = context.Properties?.GetTokenValue("access_token"); var refreshToken = context.Properties?.GetTokenValue("refresh_token"); Console.WriteLine($"Access Token: {accessToken}"); Console.WriteLine($"Refresh Token: {refreshToken}"); } };});and after build
app.Map("/login", applicationBuilder => { applicationBuilder.Run(async context => { await context.ChallengeAsync("OLX", new AuthenticationProperties { }); }); });and when I go to /login it redirrect me to login olx page - OKbut when I login I see error:
'too many redirects'
There are much redirects going.Why is that? What am I doing wrong?Please advise.
