本文介绍了帮助 - Azure B2C不适用于桌面应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我从GitHub中删除了这个例子:

I pulled down this example from GitHub:

https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-tutorials-desktop-app

连接到原始appsettings时有效,但当我将其更改为我的B2C应用程序时,我收到401错误。 我已经尝试了所有可能的组合并多次查看说明,但我仍然得到了401。

It works when connecting to the original appsettings, but when I change it to my B2C application, I get a 401 error.  I've tried every possible combination and gone over the instructions several times, but I still get the 401.

然后我尝试使用PostMan和我在此处找到的说明进行连接:

So then I tried connecting using PostMan and the instructions I found here:

而且,有趣的是,这很好用。 然后我拆开了请求以找出不同的内容。 显然,示例应用程序尝试连接到管理局:

And, interestingly, that works just fine.  So then I pulled apart the requests to find out what was different.  Apparently the example application tries to connect to the Authority at:

https://login.microsoftonline.com/tfp/ {tenant} / {policy} /oauth2/v2.0/authorize

https://login.microsoftonline.com/tfp/{tenant}/{policy}/oauth2/v2.0/authorize

但Postman示例尝试连接到权限:

But the Postman example tries to connect to the authority at:

https:// {tenant} .b2clogin.com / {tenant} / oauth2 / v2.0 / authorize?p = B2C_1_Sign_In

https://{tenant}.b2clogin.com/{tenant}/oauth2/v2.0/authorize?p=B2C_1_Sign_In

所以我更进了一步,将安全令牌从Postman中复制出来并将其塞进我的客户端应用程序中。 它工作正常!

So I took it one step further and copied the security token out of Postman and jammed it into my client application.  It worked!

当然,我认为下一步是采用PostMan权限并将其放在桌面应用程序中。 它失败了。 当我检查
PublicClientApplication 时,权限已被截断为:

So naturally I thought the next step would be to take the PostMan authority and place it in the Desktop application.  It failed.  When I examined thePublicClientApplication, the authority had been truncated to just:

https://gammafourdevelopment.b2clogin.com/gammafourdevelopment.onmicrosoft。 com /

https://gammafourdevelopment.b2clogin.com/gammafourdevelopment.onmicrosoft.com/

有人可以告诉我这个API应该如何工作,因为没有一个例子似乎是最新的(除了邮递员的例子)?

Would someone please give me an idea how this API is supposed to work as none of the examples seem to be current (except the Postman example)?




推荐答案

我做了以下步骤:

1.创建AD B2C目录。

2.创建用户流(策略) ) - > " B2C_1_signin_signup"和"B2C_1_password_reset"。

3.在B2C中创建本机应用程序并将自定义重定向uri添加为" com.onmicrosoft。< tenant-name> .appname:// redirect /路径"。$
4.克隆github repo。

5.在App类中,更改以下值:

I did the below steps:
1. Create AD B2C directory.
2. Create user flows(policies)-> "B2C_1_signin_signup" and "B2C_1_password_reset".
3. Create native application in B2C and add the custom redirect uri as "com.onmicrosoft.<tenant-name>.appname://redirect/path".
4. clone the github repo.
5. In App class, change the below values:

Tenant =< tenant-name> .onmicrosoft.com),clientId,PolicySignUpSignIn =" B2C_1_signin_signup",PolicyEditProfile =" b2c_1_edit_profile",PolicyResetPassword =" B2C_1_password_reset"和fabrikamb2c到我的< tenant-name>



运行样品,工作正常。



您能否请检查您的注册签名和密码重置策略名称以及自定义重定向uri。我建议从门户网站复制政策名称并将其粘贴到代码中。

Tenant = <tenant-name>.onmicrosoft.com), clientId, PolicySignUpSignIn = "B2C_1_signin_signup", PolicyEditProfile = "b2c_1_edit_profile", PolicyResetPassword = "B2C_1_password_reset" and fabrikamb2c to my <tenant-name>

Run the sample, it's working fine.

Could you please check your signupSignin and password reset policy names and custom redirect uri. I would suggest to copy the name of the policies from the portal and paste it into the code.

我希望这会有所帮助。

谢谢。


这篇关于帮助 - Azure B2C不适用于桌面应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 17:06