-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding example for using public OAuth (#769)
* Adding example for using public OAuth
- Loading branch information
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
```csharp | ||
using Twilio; | ||
using Twilio.Credential; | ||
using Twilio.Rest.Api.V2010.Account; | ||
|
||
//Find client id, client secret of the OAuth App | ||
//Message sid in this example is the sid of any previously sent message | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
CredentialProvider credentialProvider = new ClientCredentialProvider(CLIENT_ID, CLIENT_SECRET); | ||
TwilioClient.Init(credentialProvider, ACCOUNT_SID); | ||
|
||
/* | ||
* Or use the following if accountSid is not required as a path parameter for an API or when setting accountSid in the API. | ||
TwilioClient.init(new ClientCredentialProvider(CLIENT_ID, CLIENT_SECRET)); | ||
*/ | ||
|
||
FetchMessageOptions fm = new FetchMessageOptions(MESSAGE_SID); | ||
MessageResource m = MessageResource.Fetch(fm); | ||
Console.WriteLine(m.Body); | ||
} | ||
} | ||
``` |