网页API开放的OAuth(DotNetOpenAuth)MVC 4 [英] Web api open oauth(DotNetOpenAuth) mvc 4

查看:252
本文介绍了网页API开放的OAuth(DotNetOpenAuth)MVC 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有是在其中可以很容易地与Facebook和Twitter的集成谷歌4 MVC互联网应用模板,一个惊人的功能。但在网页API模板没有这样的功能。
我怎样才能轻松地集成 DotNetOpenAuth 使用Web API?
有没有教程?

There is an amazing feature in mvc 4 internet application template which can easily integrate with facebook twitter and google. But there is no such feature in web api template. How can I easily integrate DotNetOpenAuth with web api? Is there a tutorial?

推荐答案

MVC是面向浏览器的网站。的WebAPI是用于通过比一个浏览器的网页的其他一些客户编程访问(虽然它可以是JavaScript的运行在浏览器中)。所以需要浏览器的OpenID OAuth的或登录流量重定向没有为的WebAPI意义。不直接反正。

MVC is a browser-facing web site. WebAPI is for programmatic access by some client other than a browser web page (although it may be javascript running in the browser). So OpenID or OAuth login flows that require browser redirects don't make sense for WebAPI. Not directly anyway.

什么的确实的似乎适用的是,你希望你的WebAPI被授权,并且知道用户他们重新present。那么常见的情况是对的W​​ebAPI到作为的OAuth 2资源服务器,接受由确实接受Facebook,Twitter和谷歌这些铸造访问令牌之前登录的用户的授权服务器发出的访问令牌。

What does seem to apply is that you want your WebAPI to be authorized, and to know what user they represent. The common case then is for WebAPI to act as an OAuth 2 resource server, accepting access tokens that were issued by an authorization server that does accept Facebook, Twitter and Google to log in users before minting these access tokens.

有几个的WebAPI样品是做到这一点。这里是 之一。

There are several WebAPI samples that do this. Here's one.

这篇关于网页API开放的OAuth(DotNetOpenAuth)MVC 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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