summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/yaegashi/msgraph.go/msauth/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/yaegashi/msgraph.go/msauth/README.md')
-rw-r--r--vendor/github.com/yaegashi/msgraph.go/msauth/README.md29
1 files changed, 28 insertions, 1 deletions
diff --git a/vendor/github.com/yaegashi/msgraph.go/msauth/README.md b/vendor/github.com/yaegashi/msgraph.go/msauth/README.md
index 43aead20..50c314f1 100644
--- a/vendor/github.com/yaegashi/msgraph.go/msauth/README.md
+++ b/vendor/github.com/yaegashi/msgraph.go/msauth/README.md
@@ -58,6 +58,32 @@ var scopes = []string{msauth.DefaultMSGraphScope}
...
```
+### Resource owner password credentials grant
+
+- [OAuth 2.0 resource owner passowrd credentials grant flow]
+
+```go
+const (
+ tenantID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
+ clientID = "YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY"
+ clientSecret = "ZZZZZZZZZZZZZZZZZZZZZZZZ"
+ username = "user.name@your-domain.com"
+ password = "secure-password"
+)
+
+var scopes = []string{msauth.DefaultMSGraphScope}
+
+ ctx := context.Background()
+ m := msauth.NewManager()
+ ts, err := m.ResourceOwnerPasswordGrant(ctx, tenantID, clientID, clientSecret, username, password, scopes)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ httpClient := oauth2.NewClient(ctx, ts)
+ ...
+```
+
### Authorization code grant
- [OAuth 2.0 authorization code grant flow]
@@ -67,4 +93,5 @@ var scopes = []string{msauth.DefaultMSGraphScope}
[v2.0 endpoint]: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-overview
[OAuth 2.0 device authorization grant flow]: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-device-code
[OAuth 2.0 client credentials grant flow]: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow
-[OAuth 2.0 authorization code grant flow]: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow \ No newline at end of file
+[OAuth 2.0 authorization code grant flow]: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
+[OAuth 2.0 resource owner passowrd credentials grant flow]: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth-ropc