Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

.net Blazor serverside oauth2 olx singin too many redirects

$
0
0

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'

and indeed:enter image description here

There are much redirects going.Why is that? What am I doing wrong?Please advise.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>