- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我有一个客户想使用 SkyDrive 作为网站的云存储。本网站不会要求网站用户提供他们的 SkyDrive 帐户以向他们展示他们的文件,但网站所有者会将一些文件存储在 SkyDrive 中并希望与用户共享这些文件登录到他的网站。我的问题是,如何直接从网站的后端 PHP 代码向 SkyDrive API 发送凭据?
Live Connect 上的 API 文档 (http://msdn.microsoft.com/en-us/library/live/hh243647.aspx) 似乎侧重于向用户呈现一个登录表单,以将用户的凭据发送到服务。再一次,这不是我想要的。该网站的用户无需执行任何操作,只需转到该页面,他们就会看到从 SkyDrive 帐户镜像的文件。凭据应存储在服务器上并在用户请求页面时发送。
我问了一个与此类似的关于 Google 文档的问题 (How do I connect to the Google Calendar API without the oAuth authentication?)。这个问题的答案是设置一个临时脚本来获取一个可以反复使用的刷新 token 来进行身份验证。我试过了,它确实有效。但是,我不确定刷新 token 会持续多长时间,也不确定该方法是否适用于 SkyDrive API。
编辑:在做了更多研究之后,Live Connect 文档 (http://msdn.microsoft.com/en-us/library/live/hh826540) 说:
After a user provides consent, Live Connect gives your app a special code, or access token, that lets your app work with that portion of the user's info to which he or she consented. Typically, this access token is good for about one hour. After this hour is up, your app won't be able to work with the user's info anymore—it must ask the user to go through the sign-in and consent process again. To get around this, you can ask the user to consent to the wl.offline_access scope. This gives your app an additional code, called a refresh token, that your app can use to get a new access token whenever it needs one—even after the user signs out—typically, for up to a year. However, the user can revoke your app's access at any time. If a user chooses to revoke consent to your app, no corresponding access tokens or refresh tokens will work—your app must ask the user to go through the sign-in and consent process once again.
所以,看起来刷新 token 会持续一年。这意味着我可以操纵一些东西来获取刷新 token ,存储它,然后在每个页面请求中,使用刷新 token 来获取访问 token 并显示数据。但是,每年一次,我必须为此客户端更新刷新 token 并存储它。这听起来对吗?这是最好的方法吗?
最佳答案
OAuth 2 有一个专门用于此的特殊流程,称为 Client Credentials Grant .
Google 已经通过服务帐户和客户端证书实现了这一点,如 this answer 中所述到你的另一个问题。
但是,Microsoft 迄今为止没有 implement that flow ,因此目前最好的方法是使用您已经用于 Google 文档的解决方法。
关于php - 您如何验证单个 Skydrive 帐户而不要求用户提供凭据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12221896/
是否应该在设备中安装 SkyDrive 应用程序,以便使用我的应用程序和 skydrive sdk (livesdk) 连接 skydrive。我已经尝试使用我的应用程序客户端 ID 在 sdk zi
我正在我的博客插件中自动嵌入文档。我可以将 excel 文件上传到 skydrive,但要嵌入该文档,我应该在 Skydrive 中手动处理该文件并获取嵌入 URL。通过 skydrive API 获
我尝试使用 java 中的其余 api 将文件上传到 skydrive。 这是我的代码: public void UploadFile(File upfile) { if (uploa
我需要从我的 WP7 应用程序备份数据到 Skydrive,这个文件是 xml 文件。我知道如何连接到 skydrive 以及如何在 skydrive 上创建文件夹: try { var fo
即将发布的 WP7 Mango 版本中是否有用于将文件上传到 skydrive 的官方 API? 如果是,我在哪里可以找到示例和 API 说明? 最佳答案 根据这个SO post : SkyDrive
如果我(手动)在 Onedrive/Skydrive 中共享文件,并在 HTML5 下载元素中使用其可共享链接(这是在 ASP.NET 项目中): string fileUrl = "https://
我正在尝试创建一个应用程序,该应用程序将通过 SkyDrive API 访问文件夹及其内容。 但我只能得到我的名字和照片。由于某种未知的原因,文件夹没有被描绘。 代码运行没有错误,只是没有输出。我真的
我正在尝试使用 JavaScript 在 SkyDrive 上创建一个新文件。 到目前为止,我所做的最接近的事情是创建一个文件,但没有任何内容。 function upload() {
我有什么 我有 WEB 应用程序在必须访问 SkyDrive 文件的浏览器中运行。我使用 WL.js 提供的漂亮界面来访问当前经过身份验证的用户的文件列表: function openFromS
我想这样做,如果可能的话,我想使用 Winform 应用程序访问我的 Skydrive。实际上,我想在任何地方访问我的某些内容,或者访问其他人也可以访问它们,但不喜欢在浏览器或 Windows 手机上
我有一个客户想使用 SkyDrive 作为网站的云存储。本网站不会要求网站用户提供他们的 SkyDrive 帐户以向他们展示他们的文件,但网站所有者会将一些文件存储在 SkyDrive 中并希望与用户
目前我正在使用 client.getAsync(folder + "/files", liveListener) 来检查特定文件的文件夹内容。目前它运行良好,但如果文件夹中有很多文件(很可能有),那么
我正在开发一个 iOS 应用程序,让用户可以访问他们的 OneDrive/SkyDrive,但我遇到了一个非常烦人的问题: 用户第一次将应用链接到他们的 OneDrive 时,一切都按预期进行: 他们
有谁知道如何从 Windows Phone 7 以编程方式访问 SkyDrive?我使用什么 API?我需要将文件从手机上传到 SkyDrive,反之亦然。 一些代码示例会很棒。 :-) 最佳答案 您
我在 Rails 应用程序中使用 Skydrive gem。 为了重命名我写的文件夹 def renaming_folder client = Skydrive::Client.new(@@acc
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 7年前关闭。 Improve this qu
我在显示位于根目录内的文件夹的内容时遇到了真正的问题。它设法确定了 Files 目录中的文件夹,但是当我尝试对其中一个文件夹执行相同操作时,它不起作用。 我认为问题出在WL.api的路径名上。不过我可
更新我的应用程序后,我收到了来自认证测试的“警告”消息: The app and its associated metadata does not accurately represent its f
我正在尝试获取 SkyDrive 上登录用户的所有文件夹列表。 LiveOperationResult operationResult = await client.GetAsync("me/skyd
我正在编写一个 WP8(XAML 和 C#)应用程序来从 SkyDrive 读取一个文本文件并将其保存到 IsolatedStorage 中。 好像是读取了文件,但是我得到的数据是文件的描述,而不是文
我是一名优秀的程序员,十分优秀!