用于前端应用程序的 OAuth2 [英] OAuth2 for front end applications

查看:96
本文介绍了用于前端应用程序的 OAuth2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个需要授权工作流程的应用程序.

I'm developing an application in which I need an authorization workflow.

我正在使用 oauth2orize 库处理 OAuth2.

I m working on OAuth2 with oauth2orize library.

我的应用程序(客户端)是用 javascript 或 java (android) 编写的前端.

My applications (client) are frontends written in javascript or java (android).

  • 首先,我需要的只是一种在它们内部进行身份验证并取回访问令牌的方法.为了使它工作,我有一个资源所有者流程.我的问题是由于安全问题,我无法将我的秘密存储在我的客户端应用程序中.你知道我该怎么做吗?

  • First, what I need is simply a way to authenticate inside of them and get back an access token. To make it work, I have a resource owner flow. My problem is that I can't store my secret on my client app cause of security problems. Do you have an idea how should I do it?

另一方面,如何制作第三方登录页面?像通过XXX连接"然后在登录页面被重定向?

In the other hand, how can I make a third party login page? Like "connect trough XXX" and then be redirected on the login page?

推荐答案

隐式授权flow 适用于在给定 URL 上运行的公共客户端,例如 Javascript(并且有一种在 Android 上执行此操作的方法).

The Implicit Grant flow is for public clients operating on a given URL, like Javascript (and there's a way to do it on Android).

您将创建一个通过 XXX 连接"按钮,然后将用户重定向到 XXX 以进行身份​​验证.完成后,您将获得重定向,其中包含访问令牌网址片段.

You'll make a button "Connect through XXX" and then you redirect the user to XXX to authenticate. When that's done, you get a redirect back with the Access Token in the URL fragment.

这篇关于用于前端应用程序的 OAuth2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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