All Projects → beetcb → ms-graph-cli

beetcb / ms-graph-cli

Licence: other
elegant cli to authenticate microsoft graph

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ms-graph-cli

ms-identity-javascript-react-spa-dotnetcore-webapi-obo
A React & Redux single-page application that authorizes an ASP.NET Core web API to call MS Graph API on-behalf-of a signed-in user.
Stars: ✭ 62 (+121.43%)
Mutual labels:  ms-graph
active-directory-dotnet-deviceprofile
This sample demonstrates how to leverage ADAL .NET to authenticate user calls to a web API (in this case, the directory Graph) from apps that do not have the capability of offering an interactive authentication experience.
Stars: ✭ 18 (-35.71%)
Mutual labels:  ms-graph
ms-identity-javascript-tutorial
A chapterwise tutorial that will take you through the fundamentals of modern authentication with Microsoft identity platform in Vanilla JavaScript.
Stars: ✭ 100 (+257.14%)
Mutual labels:  ms-graph
active-directory-dotnet-admin-restricted-scopes-v2
An ASP.NET MVC application that shows how to use the Azure AD v2.0 endpoint to collect consent for permissions that require administrative consent.
Stars: ✭ 46 (+64.29%)
Mutual labels:  ms-graph
ms-identity-javascript-react-tutorial
A chapterwise tutorial that will take you through the fundamentals of modern authentication with Microsoft identity platform in React using MSAL React
Stars: ✭ 100 (+257.14%)
Mutual labels:  ms-graph
active-directory-dotnet-desktop-msgraph-v2
Sample showing how a Windows desktop .NET (WPF) application can get an access token using MSAL.NET and call the Microsoft Graph API or other APIs protected by the Microsoft identity platform (Azure Active Directory v2)
Stars: ✭ 103 (+267.86%)
Mutual labels:  ms-graph
ms-identity-javascript-angular-spa-aspnet-webapi-multitenant
Multi-tenancy tutorial demonstrating how to expose your app to users from other tenants, provide consent as admin and deploy it on Azure App Services using MSAL Angular
Stars: ✭ 18 (-35.71%)
Mutual labels:  ms-graph-api

demo

ms-graph-cli: tiny & elegant cli to authenticate microsoft graph

Description

ms-graph-cli helps you run through microsoft's get access on behalf of a user easily! Created mainly for helping onedrive & sharepoint get the access-token and refresh-token to access ms-graph API.

Graph permissons needed

  • onedrive: Files.Read.All Files.ReadWrite.All offline_access
  • sharepoint: Sites.Read.All Sites.ReadWrite.All offline_access

CLI usage

!Note: To automate the redirection process, ms-graph-cli needs your app's redirect_uri set to http://localhost:3000, the port can be changed as long as you have system permission to create a http server on that port

If you are somehow unable to meet the requirements of redirect_uri, please use the legacy version

# Print generated credentials to stdout
npx @beetcb/ms-graph-cli

# Save generated credentials to .env file
npx @beetcb/ms-graph-cli -s

# Specify the display language, support CN \ EN, default is EN
npx @beetcb/ms-graph-cli -l cn

# Or specify them both
npx @beetcb/ms-graph-cli -s -l cn

Generated credentials

It's a object(maybe .env-fromatted) contains following key-value pairs:

  • access_token: use it to access ms-graph
  • refresh_token: use it to refresh the access_token
  • redirect_uri: your application redirect uri
  • client_id: your application client id
  • client_secret: your application client secret(this can be ignored when using public client)
  • auth_endpoint: api endpoint to request token
  • drive_api: api endpoint to access your drive resource
  • graph_api: api endpoint to access ms-graph
  • site_id?: sharepoint site id

All fields in the object are your private information, please keep it safe.

TODO

  • Create a local server to catch the redirect code
  • Better error handling
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].