简体   繁体   中英

Servicestack is sending me an error when using GET for Auth

I am getting an error in the JSON JWT Auth.

GET Authenticate requests are disabled, to enable set AuthFeature.AllowGetAuthenticateRequests=true

This worked a few days ago and I cannot figure out what we changed to break it. I cannot find this property in the auth feature. I even copied the code from the GitHub unit tests. It does not see there is a property for AllowGetAuthenticateRequests in AuthFeature

        Plugins.Add(new AuthFeature(() => new CustomUserSession(),
            new IAuthProvider[]
            {
                new BasicAuthProvider(),                    //Sign-in with HTTP Basic Auth
                new JwtAuthProvider(AppSettings) {
                    //HashAlgorithm = "HM256",
                    //PrivateKey = privateKey.ExportParameters(true),
                    AuthKeyBase64 = AppSettings.GetString("jwt.auth.key"),
                    RequireSecureConnection = false,
                    //Turn on for Prod: EncryptPayload = true
                    }, //JWT TOKENS
                new CredentialsAuthProvider(AppSettings)
            })
        {
            HtmlRedirect = "/",
            //IncludeRegistrationService = true,
        });

The AuthFeature.AllowGetAuthenticateRequests property is a lambda, where you can enable all GET Requests with:

Plugins.Add(new AuthFeature(...) {
    AllowGetAuthenticateRequests = req => true
});

If it's not showing up for you then you may have an older pre-release version installed, to install the latest version, clear your NuGet packages cache :

$ nuget locals all -clear

Then restore your solution again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM