- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个正在运行的 ColdFusion 应用程序(基于网络),并实现了完整的 Google Oauth2 验证流程。这很好用,我可以通过 post 命令检索电子邮件。现在我想对 Microsoft 的 Outlook 执行同样的操作。
<小时/>当我尝试对 token URL 执行 HTTP POST 请求时,我收到一条响应,指出我的重定向 URI 无效,因为它与我用于获取代码的 URL 不同。
<小时/>我可以通过向 Oauth 端点发出 GET 请求来检索代码。我在 azure 门户中添加了一个重定向 URI(多个 URI)。当我调用此 URL 时,我会从 Outlook 获得登录屏幕,之后我成功重定向回我的应用程序。所以我猜重定向 URI 是正确的并且一切正常。
当我尝试使用收到的代码获取 token 时,我收到重定向错误。我完全不知道这些 URI 不相同的事实是如何产生的。我已经对所有内容进行了三重检查,但找不到任何问题。
<小时/>这是我收到的错误:"error":"invalid_grant","error_description":"AADSTS70000: 提供的“redirect_uri”值无效。该值必须与用于获取授权代码的重定向 URI 完全匹配。
我尝试过不同类型的格式。末尾有破折号或没有破折号。但事实上,重定向 URL 对于前面的步骤是有效的。那么为什么不选择这个呢?
当我使用它时,我还会收到诸如“代码已过期”之类的消息,所以我知道它工作正常。我已经尝试过 azure 门户中的选项。我关注了 Oauth2 Outlook Playground。但我仍然无法摆脱这个消息。我怎样才能知道这里发生了什么?
我尝试了不同的方法来完成该请求。最简单的是这个:
cfhttp(method="POST", charset="utf-8", url="https://login.microsoftonline.com/common/oauth2/v2.0/token", result="result") {
cfhttpparam(name="Content-Type", type="header", value="application/x-www-form-urlencoded");
cfhttpparam(name="grant_type", type="formfield", value="authorization_code");
cfhttpparam(name="code", type="formfield", value="M090efafb-1ce6-1d54-fda7-e48f57c33cba");
cfhttpparam(name="scope", type="formfield", value="openid offline_access profile https://outlook.office.com/mail.read https://outlook.office.com/mail.read.shared https://outlook.office.com/mail.readwrite https://outlook.office.com/mail.readwrite.shared https://outlook.office.com/mail.send https://outlook.office.com/mail.send.shared");
cfhttpparam(name="redirect_uri", type="formfield", value="#URLencode('https://bizz.bmk-is.nl/')#");
cfhttpparam(name="client_id", type="formfield", value="cdee5a0a-a409-4c41-9572-726c5bdbe93e");
cfhttpparam(name="client_secret", type="formfield", value="[HIDDEN VALUE]");
}
我将在这里发布更多信息。首先,这是我正在使用的 get:
response_url = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize";
response_url = "#response_url#?response_type=code";
response_url = "#response_url#&client_id=cdee5a0a-a409-4c41-9572-726c5bdbe93e";
response_url = "#response_url#&redirect_url=#URLencode('https://bizz.bmk-is.nl/')#";
response_url = "#response_url#&scope=openid offline_access profile";
response_url = "#response_url# https://outlook.office.com/mail.read";
response_url = "#response_url# https://outlook.office.com/mail.read.shared";
response_url = "#response_url# https://outlook.office.com/mail.readwrite";
response_url = "#response_url# https://outlook.office.com/mail.readwrite.shared";
response_url = "#response_url# https://outlook.office.com/mail.send";
response_url = "#response_url# https://outlook.office.com/mail.send.shared&prompt=login";
这是我现在遇到的错误:"error":"invalid_request","error_description":"AADSTS90102: 'redirect_uri' 值必须是有效的绝对 Uri。
最佳答案
您可能需要对“redirect_uri”进行 URL 编码。
以下是 MS Outlook REST 入门页面中的示例。注意 URI 上的编码:
GET https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=<CLIENT ID>&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F&response_type=code&scope=openid+Mail.Read
然后获取AccessToken:
POST https://login.microsoftonline.com/common/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code&code=AwABAAAA...cZZ6IgAA&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F&client_id=<CLIENT ID>&client_secret=<CLIENT SECRET>
关于azure - 重定向 URI 对于 Outlook MAIL REST API 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54591001/
我想在 DNN 模块中完成注册过程后发送电子邮件。当我搜索时,我发现 dnn 中有一个内置的邮件类。但它包含两个方法 - SendEmail 和 SendMail。这两者有什么区别?在这种情况下我必须
我有一个非常特殊的要求 我正在使用 Java Mail API 访问用户的收件箱。可以说是投诉服务信箱。用户通过向该地址发送电子邮件来注册投诉。我从收件箱中提取每封电子邮件并创建一个新的投诉。我的问题
我正在使用64位MS SQL Server 2008 R2 SP2 Express版。 我没有访问数据库邮件设置向导的权限,但是Binn目录包含DatabaseMail.exe(v10.50.1660
我正在为使用 Mail::queue 函数发送电子邮件的代码编写单元测试,如文档中的代码:https://laravel.com/docs/5.4/mocking#mail-fake 我的测试: /*
我试图使用 java 邮件 API 阅读我的 gmail 帐户中的邮件。这是代码: import java.util.*; import java.io.*; import java.awt.*; i
我已经看到关于此主题的数千个类似问题。可以肯定的是,我知道 SO 中的“标记为重复问题”。 但是,从 PHP mail() 函数获取雅虎收件箱电子邮件,简单来说,如何或必须做什么仍然不清楚。 在 Ya
我正在尝试从 php 向 gmail 帐户发送电子邮件。我的笔记本电脑上有以下设置: Windows 8 Internet connection XAMPP 1.7.4, PHP Version 5.
使用过时的 System.Web.Mail 发送电子邮件工作正常,这是代码片段: Public Shared Sub send(ByVal recipent As String, ByVal fro
有没有办法从 Java Mail API 中获取邮件是否被标记为重要?我正在使用 Gmail 帐户进行连接。提前致谢。 最佳答案 不同的邮件程序使用不同的方式来表明邮件“重要”。有些使用 X-Prio
我正在编写一个 PHP 邮件函数,一些示例有 @mail(...),而其他示例只有 mail(...)。 有什么区别,最好使用哪个? 干杯 最佳答案 @ 抑制所有警告/错误,mail() 函数可能会抛
我一直在开发一个连接到 Yahoo 邮件的 Java 应用程序,使用户能够通过他们的 Yahoo 电子邮件进行搜索。 最近,Yahoo 突然(仅提前 5 周通知)停止了我们正在使用并且运行良好的 Ya
我想发送邮件为用户重置密码,如果他忘记了密码,我会收到此错误: org.springframework.mail.MailSendException: Mail server connection f
所以,我的问题如下:我有一个用 Java 编写的邮件客户端,在使用 POP3 检查邮件后,无法通过 SMTP 发送邮件。 我捕获的异常表明传输协议(protocol) = null。 代码工作正常,因
我正在尝试使用 ruby mail gem 检索电子邮件,在示例中它说 Mail.last将检索最后一封未读电子邮件 https://github.com/mikel/mail#getting-e
在我的系统中,我应该在查看列表后发送通知邮件我正在使用 DNN 有我使用的代码 private void SendEmailNotification() { DotNetNuk
我创建了一个.sh脚本,并将结果记录在一个文件中,执行后我会尝试将文件内容作为mail正文发送。 这是我运行的命令: sh update.sh >> update.$(date +"%Y-%m-%d:
我使用 AE.NET.Mail 来阅读我的电子邮件正文。 但是那些尸体都是空的! 我的代码如下: // Connect to the IMAP server. The 'true' param
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我在尝试发送带有文件附件的电子邮件时遇到错误: javax.mail.internet.ParseException: Expected '/', got files at javax.mai
我在IntelliJ IDEA中导入了一个maven项目后,pom.xml文件有两个错误: "Failed to read artifact descriptor for javax.mail:mai
我是一名优秀的程序员,十分优秀!