Skip to content

Obsolete warning for authenticator class. #1636

Closed

Description

@msmolka

Expected Behavior

Implementing custom authenticator should not result error:
warning CS0618: 'Parameter' is obsolete: 'Use Add[XXX]Parameter methods of IRestRequest instead of instantiating the Parameter class.'

Actual Behavior

When implementing custom authenticator based on Docs and actual build in code from:
https://github.com/restsharp/RestSharp/tree/dev/src/RestSharp/Authenticators
https://restsharp.dev/usage/authenticators.html#custom-authenticator

I'm receiving an error:
warning CS0618: 'Parameter' is obsolete: 'Use Add[XXX]Parameter methods of IRestRequest instead of instantiating the Parameter class.'

The AuthenticatorBase class requires override

protected abstract Parameter GetAuthenticationParameter(string accessToken);

method

and does not allow override

public void Authenticate(IRestClient client, IRestRequest request)

method.

The build in authenticators are using forbidden statement.

To be consistent all authenticator code should be removed and and moved to AddXXXAuthentication methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions