更新移动应用程序以使用ROPC请求访问令牌时,未经Web API授权 [英] Unauthorized on Web API when updating mobile app to use ROPC to request access token

查看:119
本文介绍了更新移动应用程序以使用ROPC请求访问令牌时,未经Web API授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更新了移动应用程序,以使用ROPC策略请求Azure AD B2C令牌.当我将令牌作为不记名令牌发送时,与使用注册登录"策略相同,会出现未授权的错误.

I updated my mobile app to request an Azure AD B2C token using the ROPC policy. When I send the token as a Bearer token, same as I did with the Sign Up Sign In policy, I get an unauthorized error.

我要做的一件事是通过HttpClient请求令牌,因为新的Microsoft.Identity.Client程序包不具有AcquireTokenByUsernamePasswordAsync函数.

One thing I had to do was request the token via HttpClient because the new Microsoft.Identity.Client package does not have the AcquireTokenByUsernamePasswordAsync function.

在Web Api中,我更新了TokenValidationParameters,以将新的ROPC策略作为新的AuthenticationType,但这也不起作用.

In the Web Api, I updated the TokenValidationParameters to have the new ROPC policy as the new AuthenticationType but that does not work either.

推荐答案


我需要有关实际问题的更多详细信息.但是,Azure AD B2C实施符合公共客户端资源所有者密码凭据的OAuth 2.0标准,并且应与大多数客户端SDK兼容.我们已经在生产中对这一流程进行了广泛的测试, 适用于iOS的AppAuth和适用于Android的AppAuth.有关最新信息,请参见 用于OAuth 2.0和OpenID Connect的Native App SDK实现了现代化的最佳做法.

Hi,
I need more details about the actual issue. However, the Azure AD B2C implementation meets OAuth 2.0 standards for public client resource owner password credentials and should be compatible with most client SDKs. We have tested this flow extensively, in production, with AppAuth for iOS and AppAuth for Android. For the latest information, see Native App SDK for OAuth 2.0 and OpenID Connect implementing modern best practices.

从GitHub下载已配置为与Azure AD B2C一起使用的工作示例, 对于Android 对于iOS .

Download working samples that have been configured for use with Azure AD B2C from GitHub, for Android and for iOS.


这篇关于更新移动应用程序以使用ROPC请求访问令牌时,未经Web API授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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