Skip to content

Commit 5644c25

Browse files
authored
Update IAuthenticator? Authenticator in usage.md (#2151)
* Update usage.md Conform to updated API * Update usage.md Conform the latest API
1 parent d0b4b18 commit 5644c25

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/usage.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ Now, we need to implement the `GetToken` function in the class:
6060

6161
```csharp
6262
async Task<string> GetToken() {
63-
var options = new RestClientOptions(_baseUrl);
64-
using var client = new RestClient(options) {
63+
var options = new RestClientOptions(_baseUrl){
6564
Authenticator = new HttpBasicAuthenticator(_clientId, _clientSecret),
6665
};
66+
using var client = new RestClient(options);
6767

6868
var request = new RestRequest("oauth2/token")
6969
.AddParameter("grant_type", "client_credentials");
@@ -107,11 +107,11 @@ public class TwitterClient : ITwitterClient, IDisposable {
107107
readonly RestClient _client;
108108

109109
public TwitterClient(string apiKey, string apiKeySecret) {
110-
var options = new RestClientOptions("https://api.twitter.com/2");
111-
112-
_client = new RestClient(options) {
110+
var options = new RestClientOptions("https://api.twitter.com/2"){
113111
Authenticator = new TwitterAuthenticator("https://api.twitter.com", apiKey, apiKeySecret)
114112
};
113+
114+
_client = new RestClient(options);
115115
}
116116

117117
public async Task<TwitterUser> GetUser(string user) {

0 commit comments

Comments
 (0)