Code Monkey home page Code Monkey logo

web-netframework-oauth's Introduction

Microsoft .Net Web OAuth

目录

  • 项目介绍
  • 预备条件
  • 项目配置
  • 项目结构
  • 可用资源
  • 人员追踪

项目介绍

在使用Microsoft Graph或调用Outlook、Excel的Rest API时,需要从 Microsoft 的云标识服务 Azure Active Directory (Azure AD) 获取访问令牌。 官方已经给出了许多关于如何获取Azure AD访问令牌的例子。这个项目是以此为基础,使用.Net MVC完成对Graph的API和Office 365。 可以选择不同的分支获取对应的示例代码。 更多关于GraphAPI的使用,可参考文档:Microsoft Graph

预备条件

在使用这个项目大码的时候,需要在Azure 上或 Graph APP上注册一个应用。 可以参考文档:注册Microsoft应用

项目配置

在注册应用时,你需要保存应用的APPID(Client ID),APPSecret(Client Secret),并且将该平台上的RedirectUri修改为你项目运行的地址如http://localhost:54190 下载完项目之后,你需要在项目的根目录文件下,创建一个Azure.OAuth.config文件,并将以下代码加入到该文件中

<appSettings>
  <!--ClientID or APPId-->
  <add key="ClientID" value="Your APPID" />
  <!--ClientSecret or APPSecret-->
  <add key="ClientSecret" value="Your AppSecret" />
  <!--Tenant -->
  <!--The allowed values are 'common' for both Microsoft accounts and work or school accounts, 
    'organizations' for work or school accounts only, 
    'consumers' for Microsoft accounts only, 
    and tenant identifiers such as the tenant ID or domain name. 
  -->
  <!--Refer to https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_user#3-get-a-token -->
  <add key="Tenant" value="common"/>
  <!--RedirectURL -->
  <!--This field should be the same as the callback URL configured in the place where the APP is registered.-->
  <add key="RedirectUri" value="http://localhost:54190" />
  <!--Application permission-->
  <add key="GraphScope" value="User.Read Mail.Read Files.ReadWrite.All" />
  <!--Azure OAuth Address-->
  <add key="EndPointUri" value="https://login.microsoftonline.com/"/>
  <add key="EndPointVersion" value="v2.0"/>
</appSettings>

项目结构

可用资源

人员追踪

web-netframework-oauth's People

Contributors

jingangred avatar

Watchers

James Cloos avatar Chris Wang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.