简体   繁体   English

通过Twitter或LinkedIn OAuth登录用户,而无需打开弹出窗口

[英]Login user via Twitter or LinkedIn OAuth without opening a popup

I've implemented login with Twitter via their OAuth API. 我已经通过Twitter的OAuth API实现了登录。 I've decided to use a popup for Authorization/Authentication, which closes itself when the process ends. 我决定使用一个用于授权/身份验证的弹出窗口,该弹出窗口在流程结束时会自行关闭。

However, it really bugs me that once a user has already Authorized my app, and he is also Authenticated with Twitter, the popup will simply open and close itself. 但是,确实让我感到烦恼的是,一旦用户已经授权了我的应用程序,并且他也通过Twitter进行了身份验证 ,则弹出窗口将简单地自行打开和关闭。 I'd like to avoid creating the popup completely, but the other option is to redirect the main page for Authentication, which again I'd like to avoid since it has a flicker effect going to Twitter and back to my site. 我想避免完全创建弹出窗口,但是另一种选择是重定向身份验证的主页,这又一次我想避免,因为它会在Twitter和我的网站上产生闪烁效果。

What I'm asking, is it possible to Authenticate the user with Twitter via AJAX or any another option which doesn't require a pointless open-close popup, or flickering the screen back-and-forth with Twitter? 我要问的是,是否可以通过AJAX或不需要任何无意义的打开-关闭弹出窗口或通过Twitter来回闪烁屏幕的任何其他选项来通过Twitter对用户进行身份验证?

Facebook does this via their JS API with Ajax, but I'm asking for a server-to-server solution (I think Twitter forbids OAuth from the client anyway). Facebook通过其带有Ajax的JS API来做到这一点,但是我要求一种服务器到服务器的解决方案(我认为Twitter仍然禁止来自客户端的OAuth)。

Thanks! 谢谢!

For LinkedIn, if you are using the REST API, you can send users to the authenticate endpoint : 对于LinkedIn,如果您使用的是REST API,则可以将用户发送到authenticate端点

https://www.linkedin.com/uas/oauth/authenticate

If they are still logged in and their OAuth token is still valid, they will not see anything. 如果他们仍然登录并且他们的OAuth令牌仍然有效,那么他们将看不到任何内容。

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

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