This extension provides utility methods to build URI for OAuth authorization purpose.
var rc = new RestClient(...);
var authorizeUriExtension = new AuthorizeUriExtension(...);
await rc.InstallExtension(authorizeUriExtension);
var uri = authorizeUriExtension.BuildUri(new AuthorizeRequest
{
redirect_uri = "http://localhost:3000/callback",
state = "myState"
});
Please refer to the TypeScript SDK documentation for more information. These two SDKs are very similar.
In short, when you invoke the BuildUri
method, if you can pass in a code_challenge_method
property with
value "S256"
, the method will auto generate codeVerifer
and code_challenge
for you. codeVerifier is accessible
via authorizeUriExtension.codeVerifier
after the method is called. code_challenge
is included in the URI.
Please note that, if you are using PKCE, you should not specify clientSecret
, leave it as null
.
It will not break your app if you specify a clientSecret
, but it defeats the purpose of PKCE.
This extension is inspired by its TypeScript counterpart , check its documentation for more information.