How can I connect to Google using oauth with Ruby?

2020-07-08 07:26发布

there are oauth and oauth2 gems, but I have not found an example to connect to google with oauth

标签: ruby oauth
2条回答
地球回转人心会变
2楼-- · 2020-07-08 07:56

Try omniauth instead.

https://github.com/intridea/omniauth

Here's An excellent screencast showing how its used: http://railscasts.com/episodes/241-simple-omniauth

查看更多
倾城 Initia
3楼-- · 2020-07-08 08:07

The officially supported method is to use Signet. The README contains the example code required to authenticate against the Google OAuth endpoints. See also the Google API Client for Ruby. If you have any questions on either, don't hesitate to ping me. I'm supporting both libraries.

Signet will also work for other OAuth providers. An official OmniAuth plugin is also available.

查看更多
登录 后发表回答