使用Microsoft开发应用程序的Microsoft帐户OAuth [英] OAuth with Microsoft account using Microsoft dev app

查看:149
本文介绍了使用Microsoft开发应用程序的Microsoft帐户OAuth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我已经创建了一个测试MVC应用程序并尝试使用Microsoft dev app实现Oauth Microsoft登录。


我已经为开发应用程序提供了所有适当的详细信息(据我所知),但我不确定我应该设置为redirect_uri的值。


目前,我给了"http:// localhost:44301 / signin-microsoft"。并试过"http:// localhost:44301 /"另外,因为我通过代码运行它。


我尝试通过https://manage.auth0.com/和代码测试它,但我得到"我们无法完成您的请求"。当我查看网址时,它有"error_description = +提供+值+ + +输入+参数+'redirect_uri'+是+非+有效。+ +预期+值+是+'https://登录.live.com / oauth20_desktop.srf'+或+ a + URL +其中+匹配+ +重定向+ URI +注册+ +此+客户端+应用程序"   ;


我也尝试过提供"https://login.live.com/oauth20_desktop.srf"在开发应用程序中重定向uri。但是我收到同样的错误。


仅供参考,能够通过https://manage.auth0.com/测试/尝试使用相同开发应用的谷歌帐户,我可以看到"它起作用"屏幕。但是当我使用相同的开发应用程序测试微软(实时)帐户时,我收到此错误。



卡住了。任何帮助表示赞赏。



谢谢,


Starlin。

解决方案

Hi Starlin, 



你用于redirect_uri的内容必须与你在应用程序中放置的内容相匹配
https://apps.dev.microsoft.com/。 如果URI不同,那么您将收到该错误。 


例如,如果您要使用 


谢谢,


Gianpaolo Valero 






Hi,

I've created a test MVC app and try to implement Oauth Microsoft login using Microsoft dev app.

I've given all appropriate details(as per my knowledge) for the dev app but am not sure what value i should set as redirect_uri.

Currently, I gave "http://localhost:44301/signin-microsoft" and tried "http://localhost:44301/" also, Since I run it through code.

I tried testing it through https://manage.auth0.com/ and code as well, but i get "We're unable to complete your request". When I look into the url, it has "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" 

I also tried giving "https://login.live.com/oauth20_desktop.srf" as redirect uri in the dev app. But I receive the same error.

FYI, Am able to test/try google account with same dev app through https://manage.auth0.com/ and I could see "It works" screen. But I get this error when I test microsoft(live) account using same dev app.

Am stuck. any help appreciated.

Thanks,

Starlin.

解决方案

Hi Starlin, 

What you use for the redirect_uri has to match what you put in your application here https://apps.dev.microsoft.com/. If the URI is different then you will get that error. 

For example, if you want to use Authorization Code Grant Flow in step 1, when you're requesting user consent your url would look like something like this:

https://login.live.com/oauth20_authorize.srf?client_id=CLIENT_ID&scope=bingads.manage&response_type=code&redirect_uri=REDIRECTURI&state=ClientStateGoesHere

Let's say you use "https://login.live.com/oauth20_desktop.srf" as your redirect URI, then you're user consent URL would look like this

https://login.live.com/oauth20_authorize.srf?client_id=CLIENT_ID&scope=bingads.manage&response_type=code&redirect_uri=https://login.live.com/oauth20_desktop.srf&state=ClientStateGoesHere

This would have to match your registered application as per screenshot below:

From: https://apps.dev.microsoft.com/

Please have a look at this guide https://msdn.microsoft.com/en-us/library/bing-ads-user-authentication-oauth-guide(v=msads.100).aspx to have full context on how we leverage OAuth 2.0 and the different options you have to authenticate through this method. Alternatively, depending on the programming language you're using feel free to leverage our SDKs documentation, e.g. C# Using OAuth getting started guide

Thanks,

Gianpaolo Valero 


这篇关于使用Microsoft开发应用程序的Microsoft帐户OAuth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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