lib/helpers/controller_helpers.rb in wepay-rails-0.1.33 vs lib/helpers/controller_helpers.rb in wepay-rails-0.1.34

- old
+ new

@@ -1,10 +1,10 @@ module WepayRails module Helpers module ControllerHelpers - def redirect_to_wepay_for_auth(scope) + def redirect_to_wepay_for_auth(scope=gateway.scope) redirect_to gateway.auth_code_url(scope) end def redirect_to_wepay_for_token redirect_to gateway.token_url @@ -24,10 +24,12 @@ # # Response # {"user_id":"123456","access_token":"1337h4x0rzabcd12345","token_type":"BEARER"} Example def initialize_wepay_access_token(auth_code) wepay_access_token = gateway.access_token(auth_code) - raise unless wepay_access_token.present? + rescue WepayRails::Exceptions::ExpiredTokenError => e + redirect_to_wepay_for_auth gateway.scope + return end # Since we are saving the access token in the session, # ensure key uniqueness. Might be a good idea to have this # be a setting in the wepay.yml file. \ No newline at end of file