在Web应用程序的OneDrive文件选择器中支持多个域/子域 [英] Support for multiple domains/subdomains in OneDrive File Picker for Web Apps

查看:133
本文介绍了在Web应用程序的OneDrive文件选择器中支持多个域/子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个CMS,可为2000多个学校网站提供支持.这些网站中的每个网站的管理网站都位于同一根域下,例如*.myadmin.com.我们正在将 OneDrive文件选择器集成到所有这些页面中管理网站.

We have a CMS that powers over 2000 school websites. The admin sites for each of those websites are all under the same root domain, e.g. *.myadmin.com. We are working on integrating OneDrive File Picker on multiple pages in all of those admin sites.

我们在API设置中的Redirect URLs出现了问题.我们试图通过将Redirect URLs:设置为https://myadmin.com来将Root domain字段设置为myadmin.com.在JavaScript中,我们像这样初始化文件选择器:

We have an issue with the Redirect URLs in the API Settings. We tried to set the Root domain field to myadmin.com by setting Redirect URLs: to https://myadmin.com. In JavaScript, we initialize the File Picker like this:

WL.init({
    client_id: window.OneDrive.clientId,
    redirect_uri: ''
});
WL.fileDialog({
    mode: "open",
    select: "single"
});

这将导致一个弹出窗口显示:

That results in a popup window saying:

We're unable to complete your request. Microsoft account is experiencing technical problems. Please try again later.

在弹出窗口的地址栏中,还有进一步的错误描述(URL解码):

In the address bar of the popup window, there's a further error description(url decoded):

error_description=The provided value for the input parameter 'redirect_uri' is not valid. The expected value is 'https://login.live.com/oauth20_desktop.srf' or a URL which matches the redirect URI registered for this client application.

在API设置中放置一个特定的网址(例如https://subdomain.myadmin.com/homepage)将使Picker在该特定页面上的 上起作用,但不能在其他页面上起作用.看起来它正在寻找完全匹配的内容.对于我们每个使用OneDrive的页面创建单独的应用程序,显然对我们来说是不切实际的.

Putting a specific url, like https://subdomain.myadmin.com/homepage, in the API Setting would make the Picker work on that specific page, but not on other pages. Looks like it's looking for an exact match. Obviously it's not practical for us to create a separate app for each page that uses OneDrive.

可以通过在"API设置"页面上禁用Enhanced redirection security来解决该问题.该选项是在几周前我们创建用于开发的应用程序时存在的,但是被标记为已弃用.今天,当我们创建用于生产的新应用程序时,已经不存在了,我认为现在所有新应用程序都启用了该应用程序.

The problem can be solved by disabling Enhanced redirection security on the API Settings page. That option existed a few weeks ago when we created an app for development, but was marked as deprecated. Today when we created a new app for production, it wasn't there anymore, which I think is now enabled for all new apps.

我们在Dropbox Drop-ins Chooser中遇到了类似的问题,但是我们可以通过将myadmin.com设置为应用程序域来解决该问题.

We had a similar issue with Dropbox Drop-ins Chooser, but we were able to solve the problem by setting myadmin.com as the domain of the app.

有没有解决此问题的方法?

Is there any work around for this problem?

感谢您的帮助和建议.

推荐答案

您可以添加多个重定向URL,只要它们都在同一个子域中即可.每个重定向URL需要明确指定:

You can add multiple Redirect URLs as long as all of them are in the same subdomain. Each redirection URL needs to be specified explicitly:

这篇关于在Web应用程序的OneDrive文件选择器中支持多个域/子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆