Sha256: 1433209760ceff5929dd62208509baa2e8b159554fe04c6b474cc08c50162392
Contents?: true
Size: 758 Bytes
Versions: 6
Compression:
Stored size: 758 Bytes
Contents
require_dependency 'google_sign_in/redirect_protector' class GoogleSignIn::CallbacksController < GoogleSignIn::BaseController def show if valid_request? redirect_to proceed_to_url, flash: { google_sign_in_token: id_token } else head :unprocessable_entity end rescue GoogleSignIn::RedirectProtector::Violation => error logger.error error.message head :bad_request end private def valid_request? flash[:state].present? && params.require(:state) == flash[:state] end def proceed_to_url flash[:proceed_to].tap { |url| GoogleSignIn::RedirectProtector.ensure_same_origin(url, request.url) } end def id_token client.auth_code.get_token(params.require(:code))['id_token'] end end
Version data entries
6 entries across 6 versions & 1 rubygems