基本身份验证而不是AAD(Azure Active Directory)身份验证 [英] Basic Authentication instead of AAD (Azure Active Directory) Authentication

查看:84
本文介绍了基本身份验证而不是AAD(Azure Active Directory)身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Microsoft Teams应用程序需要访问使用基本身份验证的REST Web服务.

my Microsoft Teams app needs to access a REST web service that uses Basic Authentication.

这些教程似乎仅显示了如何使用Azure Active Directory进行身份验证:

the tutorials only seem to show how to do this for authentication with Azure Active Directory:

https://docs.microsoft.com/zh-CN/learn/modules/embedded-web-experiences/7-exercise-implement-tab-authentication

以上教程向用户显示了登录提示并验证了客户端.我该如何为基本身份验证实现类似的东西?

the above tutorial shows the user a login prompt and authenticates client side. how do i implement something like this for Basic Authentication?

编辑:我提到的是客户端,因为我希望Teams记住登录名.Web服务基本上是用于协作的.所以我不能为所有用户使用相同的帐户

EDIT: i'm mentioning client side because i want Teams to remember the login. the web service is basically for collaboration. so i can't use the same account for all users

EDIT2

为完整起见,我包括一个最终工作的示例客户端调用(它像在浏览器中一样,第一次向用户显示登录弹出窗口):

for completeness i'm including an example client side call that ended up working (it shows a login popup to the user the first time as it does in a browser):

var url = "https://example.com/Service.svc/Request";
var init = {credentials:"include", headers:{"Accept":"application/json"}};
fetch(url,init)
    .then(response => response.text())
    .then(data => alert(data));

推荐答案

我假设您正在尝试访问一些需要基本身份验证的外部页面或资源.否则,没有理由尝试宣誓.团队似乎支持标签的基本身份验证,例如,我可以将标签添加到带有基本身份验证的网站上,然后会出现一个紫色弹出窗口,但是如何从应用程序中触发它却是另一回事.假设您只是在整个时间一直在呼叫 https://api.abc.com/whatever 应用程序,一种也许"的解决方案是将iframe嵌入团队应用程序视图中的某个位置,然后加载该域,例如https://api.abc.com/test 如果该页面需要身份验证,它将弹出这个紫色的身份验证窗口,您可以在其中键入基本身份验证".执行此操作后,团队浏览器"从理论上讲,现在应该已对会话进行身份验证.

I assume you are trying to access some external page or resource that requires basic auth.. otherwise there would be no reason to try to do oath. Teams Seems to support Basic Auth for tabs, eg i can add a tab point it to a website with basic auth, and a purple popup will appear, but how to trigger it from an application would be a different story. assuming you're just calling https://api.abc.com/whatever all the time in the app, one "maybe" solution would be to embed an iframe somewhere in your teams app view, and load that domain, like https://api.abc.com/test if that page requires authentication, it should popup this purple authenticate window that you can type in your "basic auth" in. after you do that, the teams "browser" in theory should now have a session authed.

如果您不喜欢这种方式,则可以在应用程序中创建一个初始页面,在该页面中输入用户名和密码,然后输入内容,然后进行http调用,如下所示:https://stackoverflow.com/a/57665644/13470894 吗?

If you don't like this way, you could make an initial page in your app where they type in their username and password, take the input and then make an http call something like this: https://stackoverflow.com/a/57665644/13470894 ?

希望这会有所帮助

此致

这篇关于基本身份验证而不是AAD(Azure Active Directory)身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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