如何从Microsoft OAuth2获取令牌?

时间:2019-01-11 14:45:53

标签: javascript oauth-2.0 microsoft-flow

我使用带有Microsoft oauth2的React OAuth Flow。我成功通过了授权,但无法收到令牌。有谁知道如何获得令牌?

这就是我的授权方式

<OauthSender
        authorizeUrl={`https://login.microsoftonline.com/${
          this.data.dialog.microsoftTenant
        }/oauth2/v2.0/authorize?`}
        clientId="****************"
        redirectUri="http://localhost:8080/add-sources"
        args={{
          response_type: "code",
          scope:
            "https://outlook.office.com/mail.read https://outlook.office.com/contacts.read https://outlook.office.com/calendars.read ",
        }}
        render={({ url }) => (
          <a href={url} className="btn buttons-add-sources__auth-link">
            Connect
          </a>
        )}
      />

并获得令牌:

        <OauthReceiver
          tokenUrl="https://login.microsoftonline.com/common/oauth2/v2.0/token "
          clientId="****************"
          clientSecret="**************"
          redirectUri="http://localhost:8080/add-sources"
          onAuthSuccess={this.handleSuccess}
          onAuthError={this.handleError}
          render={({ processing, error }) => (
            <div>
              {processing && <p>Authorizing now...</p>}
              {error && (
                <p className="error">
                  {this.props.location.search.split("=").pop()}
                </p>
              )}
            </div>
          )}

错误消息: enter image description here

0 个答案:

没有答案