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

How to properly add parameters to Auth0 PKCE authentication flow with Blazor WebAssembly Standalone App?

$
0
0

I am looking for a solution to add additional parameters to the user authentication request. By default, I cannot add parameter "Audience" or "Code_challenge". I would like to add these parameters, so I could receive back the code, which I could exchange for an access token.

Both code_challenge, code_challenge_method and audience are required in order to send request similar to this:

https://xxxxxxxxx.eu.auth0.com/authorize?    response_type=code&    code_challenge={codeChallenge}&    code_challenge_method=S256&    client_id=someexampleclientid    redirect_uri={CallbackUrl}&    scope={offline_access}

Currently I tried to provide additional parameters like this in Program.cs:

builder.Services.AddOidcAuthentication(options =>{    builder.Configuration.Bind("Auth0", options.ProviderOptions);    options.ProviderOptions.DefaultScopes.Clear();    options.ProviderOptions.ResponseType = "code";    options.ProviderOptions.DefaultScopes.Add("offline_access");    options.ProviderOptions.AdditionalProviderParameters.Add("audience", "https://xxxxxxxxxx.eu.auth0.com/api/v2/");    options.ProviderOptions.AdditionalProviderParameters.Add("code_challenge_method", "S256");    options.ProviderOptions.AdditionalProviderParameters.Add("code_challenge", codeChallenge);

Unfortunately, server does not accept audience, code_challenge and code_challenge_method provided like this.

The goal is to receive access token and refresh token from Auth0, so it can be used later to retrieve data from secured API.

This is Single Page Application, without a backend (I have API created on external service in order to provide the application with some data).

I will appreciate any suggestion. Thanks!


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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