gpt4 book ai didi

ruby-on-rails - 在 Ruby 中验证 Google ID token 的完整性

转载 作者:数据小太阳 更新时间:2023-10-29 06:53:47 24 4
gpt4 key购买 nike

我正在将 Google 登录功能集成到 Rails 驱动的站点。我正在按照 https://developers.google.com/identity/sign-in/web/backend-auth 上的指南进行操作,但我遇到了一些问题。

主要挂断是验证 ID token 的完整性 段落。它概述了验证 JWT 的几个步骤,然后指出:

Rather than writing your own code to perform these verification steps, we strongly recommend using a Google API client library for your platform, or calling our tokeninfo validation endpoint.

我一直在使用 tokeninfo 端点进行调试,但文档指出:

[the tokeninfo endpoint] is suitable only for deployments with fewer than 100 monthly active users, as well as for debugging and informational purposes.

...

Using one of the Google API Client Libraries is the recommended way to validate Google ID tokens in a production environment.

对于 Java,Google API 客户端库包含一个 GoogleIdTokenVerifier可以验证 id token 的对象。

对于 Python,一个 verify_id_token提供功能。

我在文档中搜索了 Google Client API Ruby gem (目前处于 alpha 阶段)以及 google-auth-library-ruby gem,但未能找到等效的功能。

Ruby 是否有这些的等价物?


更新:

看来 https://code.google.com/p/google-id-token/可以这样做;然而,该项目自 2014 年以来就没有更新过。

我正在寻找一个维护的项目,最好直接来自 Google。

最佳答案

存储库已移至此处:https://github.com/google/google-id-token

看起来正在积极维护。

关于ruby-on-rails - 在 Ruby 中验证 Google ID token 的完整性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31390066/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com