使用 google 配置 authlogic-oauth [英] Configuring authlogic-oauth with google

查看:55
本文介绍了使用 google 配置 authlogic-oauth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习 Rails,并且正在开发一款使用 Google 进行登录和日历数据的应用.我目前正在配置 authlogic-oauth 并且遇到了一些问题.

I am trying to learn rails, and I'm working on an app that uses Google for logins and also for calendar data. I'm currently working on configuring authlogic-oauth and having some issues.

我一直在关注 authlogic-oauth(见上面的链接)插件的指南,我正在进行第 4 步和第 5 步.首先,我仍在学习这门语言,但我不确定代码在哪里从第 4 步开始进入控制器:

I've been following the guide for the authlogic-oauth (see link above) plugin, and I'm on steps 4 and 5. First off, I am still learning the language and I'm not sure where the code from step 4 goes in the controllers:

@user_session.save do |result|  
  if result  
    flash[:notice] = "Login successful!"  
    redirect_back_or_default account_url  
  else  
    render :action => :new  
  end  
end  

其次,我正在尝试设置第 5 步,即实际的 Google oauth 数据步骤:

Secondly, I'm trying to set up step 5, the actual Google oauth data step:

class UserSession < Authlogic::Session::Base  
  def self.oauth_consumer  
    OAuth::Consumer.new("*TOKEN*", "*SECRET*",  
    { :site=>"**http://google.com**",  
      :authorize_url => "*http://google.com/xxx*" })  
  end  
end  

我不完全确定在哪里可以找到我需要填写的信息.我一直在阅读 https://developers.google.com/identity/protocols/OAuth_ref,但我不确定我从哪里获得所有内容以及插件为自己处理什么.

I'm not entirely sure where I find the info I need to fill this in. I've been reading https://developers.google.com/identity/protocols/OAuth_ref, but I'm just not sure where I get everything and what the plugin handles for itself.

最后,我不太确定如何检索日历信息,IRC 上的某个人刚刚告诉我可以.我是通过这个插件完成的还是必须使用另一个插件?

Finally, I'm not quite sure how I retrieve the calendar info, I've just been told I could by someone on IRC. Do I do it through this plugin or do I have to use another one as well?

推荐答案

如何使用 Google OAuth 登录到您的 Ruby on Rails 应用程序,您可以在 manu-j 博客.第一段提到了如何获取这些密钥.您必须在 google 上注册您的域名.

How to login with Google OAuth into your Ruby on Rails application you can read at manu-j blog. There is mentioned in first paragraph how to obtain those keys. You have to register your domain with google.

但这只是登录您的应用程序,而不是您的谷歌帐户.听起来您认为使用 OAuth 登录后,您可以访问所有谷歌应用程序和谷歌保存的数据(如日历).OAuth 服务类似于 OpenID.两者都只是在您的应用中对用户进行身份验证的服务(而不是注册到您的应用中).

But this just logging into your app, not into your google acount. It sounds you think after logging with OAuth you can access all your google applications and google saved datas (like calendar). The OAuth service is similar to OpenID. Both are only services to autenticate user in your app (instead of registering into your app).

如果您想在您的应用中使用一些 Google 日历数据,您可以从 Googlecalendar gem 开始,rails 插件示例.

If you want to use some Google calendar data in your app, you can start with Googlecalendar gem, rails plugin and example.

这篇关于使用 google 配置 authlogic-oauth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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