github.com/yaegashi/msgraph.go@v0.1.4/cmd/msgraph-me/README.md (about)

     1  # msgraph-me
     2  
     3  This example shows user's profile of signed in user, then downloads files in the root folder of user's drive.
     4  
     5  ```console
     6  $ msgraph-me
     7  To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code H5N62P7KQ to authenticate.
     8  2019/12/07 02:39:21 Get current logged in user information
     9  2019/12/07 02:39:21 GET https://graph.microsoft.com/v1.0/me
    10  {
    11    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
    12    "id": "6764eb11-841c-444e-b770-0e0d8748ea0a",
    13    "displayName": "八重樫 剛史",
    14    "givenName": "剛史",
    15    "mail": "yaegashi@l0wdev.onmicrosoft.com",
    16    "surname": "八重樫",
    17    "userPrincipalName": "yaegashi@l0wdev.onmicrosoft.com"
    18  }
    19  2019/12/07 02:39:21 Get files in the root folder of user's drive
    20  2019/12/07 02:39:21 GET https://graph.microsoft.com/v1.0/me/drive/root/children
    21  2019/12/07 02:39:21   FILE 2019-10-27T07:57:28Z       7972 Book.xlsx
    22  2019/12/07 02:39:21   FILE 2019-10-27T07:57:19Z      11395 ドキュメント.docx
    23  2019/12/07 02:39:21   FILE 2019-10-27T07:57:36Z      29014 プレゼンテーション.pptx
    24  Press ENTER to download files or Ctrl-C to abort: 
    25  2019/12/07 02:39:25 Download "Book.xlsx" (7972 bytes)
    26  2019/12/07 02:39:25 Download "ドキュメント.docx" (11395 bytes)
    27  2019/12/07 02:39:25 Download "プレゼンテーション.pptx" (29014 bytes)
    28  ```
    29  
    30  It uses [Azure AD v2 device code flow] for the user authentication.
    31  You can authenticate yourself with your personal (Microsoft) or organizational (Azure AD) account.
    32  
    33  It saves auth tokens in `token_cache.json` in the current directory.
    34  You won't be asked for authentication again until tokens in this file expires.
    35  
    36  ## Reference
    37  
    38  - [Azure AD v2 device code flow]
    39  
    40  [Azure AD v2 device code flow]: https://docs.microsoft.com/ja-jp/azure/active-directory/develop/v2-oauth2-device-code