简体   繁体   English

OAuth2刷新令牌。 如何在客户端存储它

[英]OAuth2 Refresh Token. How to store it on client-side

There is Authorization OAuth2 Server to get access+refresh token . 授权OAuth2服务器来获取访问+刷新令牌 As far as i understand, access token can be stored on client-side , because it has short live circle. 据我所知, 访问令牌可以存储在客户端 ,因为它有短暂的循环。 But can refresh token be stored there? 但是可以刷新令牌吗? According information that I've read, there is no secure way to do it (here) 根据我读过的信息,没有安全的方法(这里)

So, I have to implement separate server-side service, just to store refresh token . 所以,我必须实现单独的服务器端服务,只是为了存储刷新令牌

Am I right? 我对吗? Is it only one possible way to store refresh token ? 它只是存储刷新令牌的一种可能方式吗?

PS Client-side: angularJS PS客户端:angularJS

Yes you are right. 是的,你是对的。 If you cannot authenticate with the Authorisation server (ie pass client ID and secret) then you will only get a short-lived access token. 如果您无法通过授权服务器进行身份验证(即传递客户端ID和密钥),那么您将只获得一个短期访问令牌。

As Angular code is on the client it would be insecure for it to hold your client secret. 由于Angular代码在客户端上,因此保密客户端是不安全的。 Therefore you can not pass your client secret to the Auth server, so you can not authenticate. 因此,您无法将客户端密钥传递给Auth服务器,因此无法进行身份验证。

Also your server code would not just store a token, it would be expected to host an endpoint which would accept an auth code and then call the Auth server with that code (and your client credentials) to get a token and refresh token. 此外,您的服务器代码不仅会存储令牌,还需要托管一个接受授权代码的端点,然后使用该代码(以及您的客户端凭据)调用Auth服务器以获取令牌和刷新令牌。

The auth code would be supplied to your server endpoint via a call from the auth server via an http redirect following successful user login and user granting access to your app. 在成功的用户登录和用户授予对您的应用程序的访问权限之后,auth代码将通过来自auth服务器的调用通过http重定向提供给您的服务器端点。

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

相关问题 如何在纯客户端应用程序中从Google OAuth 2.0 API刷新access_token? - How to refresh access_token from Google OAuth 2.0 API in a pure client-side application? 来自客户端 javascript 的错误 400 Cognito /oauth2/token 端点 - Error 400 Cognito /oauth2/token endpoint from client-side javascript 如何刷新客户端的Google API访问令牌? - How to refresh a client-side Google api access token? 客户端oauth2工作流程:参数与标头 - Client-side oauth2 workflow: parameter vs. header 客户端JavaScript Facebook OAuth2实现? - Client-side JavaScript Facebook OAuth2 implementation? 如何在客户端并行处理多个请求/API 调用的 JWT 刷新令牌? - How to handle JWT refresh token on client-side with multiple requests / API calls in parallel? 如何使用 Node js 存储每个用户的访问和刷新令牌(oAuth2) - How to store each users Access- and Refresh Token (oAuth2) using Node js OAuth2授权代码授予流Node.js与客户端混合 - OAuth2 Authorization Code Grant Flow Node.js mixed with Client-Side 如何在页面刷新时发送OAuth2访问令牌? - How to send OAuth2 access token on page refresh? 如何使用Google OAuth2 javascript获取刷新令牌? - How to get a refresh Token with Google OAuth2 javascript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM