Passing parameters on login with OWIN

Hi There,

I’m using Microsoft.Owin version 4.1.0 in my Webforms Asp.Net (.net 4.7.2) web application.

I found lots of examples for Asp.net MVC (most of them can be used in my application) but not so many for webforms. I’ve managed to authenticate my application with Auth0 but I bumped into an obstacle. I want to pass parameters on logon and get back it on successful authentication. I found some examples but at the moment none of those are working for me.

Here is what am I using:

var properties = new AuthenticationProperties() { RedirectUri = ConfigurationManager.AppSettings["redirectURI"] };

properties.Dictionary.Add("someparameter", "some_data_to_pass"));

Context.GetOwinContext().Authentication.Challenge(properties, "Auth0");

also, I’m trying to access this dictionary on RedirectToIdentityProvider and try to pass it to the middleware

if (notification.ProtocolMessage.RequestType == OpenIdConnectRequestType.Authentication)
                    {
                        notification.ProtocolMessage.SetParameter("audience", apiAudience);
                        notification.ProtocolMessage.SetParameter("test", "testparam"); // here I try to pass the previously set param from the properties.Dictionary but don't know how so I just pass the 'test' param
                   
                    }

After successful authentication, I’m looking for the parameters in here

var data = HttpContext.Current.GetOwinContext();

Not sure if I’m on the right track or I’m completely wrong.

I would greatly appreciate any help.