简体   繁体   English

如何从Azure函数访问API(通过Azure Ad B2C令牌进行身份验证)?

[英]How to access API (authenticated with Azure Ad B2C token) from a Azure function?

I have an API which is set up with "Azure AD B2C" authentication. 我有一个使用“ Azure AD B2C”身份验证设置的API。 I want to access my API from an Azure function. 我想从Azure函数访问我的API。 However, Azure Ad B2C has few limitations. 但是,Azure Ad B2C几乎没有限制。 I think I cannot get "Azure AD B2C" token without user interaction. 我想如果没有用户交互,我将无法获得“ Azure AD B2C”令牌。 My Azure function is running in a scheduled mode and will not have any user interaction. 我的Azure功能正在计划模式下运行,并且不会与用户进行任何交互。 B2C documentation says "Daemons/server-side apps" are not supported with Azure AD B2C. B2C文档说Azure AD B2C不支持“后台程序/服务器端应用程序”。 Can someone help me how do I resolve this? 有人可以帮我解决这个问题吗?

One of my colleagues was thinking that we should also let the API accept "Azure AD" token. 我的一位同事认为我们也应该让API接受“ Azure AD”令牌。 Since "Azure AD" offers client credential flow. 由于“ Azure AD”提供了客户凭证流。 But I am not sure if we can make the API accept both "Azure AD B2C" and "Azure AD" authentication at a time. 但是我不确定是否可以使API一次接受“ Azure AD B2C”和“ Azure AD”身份验证。 Also, I am not sure if this is even a good idea 另外,我不确定这是否是个好主意

You are correct, B2C requires user interaction to receive a token*. 没错,B2C需要用户交互才能接收令牌*。

But I am not sure if we can make the API accept both "Azure AD B2C" and "Azure AD" authentication at a time. 但是我不确定是否可以使API一次接受“ Azure AD B2C”和“ Azure AD”身份验证。

Yes, you can do this (I will find a sample or create one). 是的,您可以执行此操作(我将找到一个示例或创建一个示例)。

Also, I am not sure if this is even a good idea 另外,我不确定这是否是个好主意

I don't see why not. 我不明白为什么不这样。 You are saying you have multiple STS's you trust, nothing wrong with that. 您是说您信任多个STS,这没错。

*The ROPC flow is in private preview but from what I've read I wouldn't use it. * ROPC流程处于私有预览中,但是从我阅读的内容来看,我不会使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM