Skip to content

Commit 18b87d8

Browse files
committed
Update README.md
1 parent c825169 commit 18b87d8

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ using Patreon.Api;
2525

2626
public class MyService(IPatreonApi patreonApi)
2727
{
28+
// Get the active tier ids for a user based on your campaign id
2829
public async Task GetTiers()
2930
{
3031
AuthorizationTokens tokens = new()
@@ -45,6 +46,31 @@ public class MyService(IPatreonApi patreonApi)
4546
4647
IReadOnlyList<string>? tiers = response.GetTierIds("your-campaign-id");
4748
}
49+
50+
// Manually refreshing the access + refresh tokens using a user refresh token and your client id + secret
51+
public async Task ManualTokenRefresh()
52+
{
53+
PatreonTokenResponse response = await patreonApi.GetToken(
54+
PatreonTokenRequest.FromRefreshToken(
55+
authTokens.RefreshToken,
56+
"your-client-id",
57+
"your-client-secret"
58+
)
59+
);
60+
}
61+
62+
// Getting access + refresh tokens using a code from the Patreon OAuth2 flow
63+
public async Task GetTokensFromCode(string code)
64+
{
65+
PatreonTokenResponse response = await patreonApi.GetToken(
66+
PatreonTokenRequest.FromCode(
67+
code,
68+
"your-client-id",
69+
"your-client-secret",
70+
"your-redirect-uri"
71+
)
72+
);
73+
}
4874
}
4975
```
5076

0 commit comments

Comments
 (0)