用于前端应用程序的 OAuth2

编程入门 行业动态 更新时间:2024-10-18 16:50:55
本文介绍了用于前端应用程序的 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

本文发布于:2023-11-15 03:57:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1590934.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!