Skip to content

Instantly share code, notes, and snippets.

@pacojp
Created December 14, 2010 10:22
Show Gist options
  • Save pacojp/740241 to your computer and use it in GitHub Desktop.
Save pacojp/740241 to your computer and use it in GitHub Desktop.
class OpenidController < ApplicationController
def start
identifier = "https://mixi.jp"
if using_open_id?(identifier)
open_id_authentication(identifier)
end
end
def open_id_authentication(identifier)
authenticate_with_open_id(identifier,
:required => [ :nickname ] ) do |result, identity_url, registration|
logger.info("result.status=#{result.status}")
case result.status
when :missing
render :text=> "Sorry, the OpenID server couldn't be found"
when :invalid
frender :text=> "Sorry, but this does not appear to be a valid OpenID"
when :canceled
render :text=> "OpenID verification was canceled"
when :failed
render :text=> "Sorry, the OpenID verification failed"
when :successful
puts "identity_url" * 80
p identity_url
# do something
render :text=> "ok"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment