lib/fb/auth.rb in fb-auth-1.0.0.alpha2 vs lib/fb/auth.rb in fb-auth-1.0.0.alpha3

- old
+ new

@@ -12,12 +12,18 @@ # @option [String] :code A single-use authorization code provided # by Facebook OAuth to obtain an access token. def initialize(options = {}) @redirect_uri = options[:redirect_uri] @code = options[:code] + @refresh_token = options[:refresh_token] end + # @return [Boolean] whether the authentication was revoked. + def revoke + !!HTTPRequest.new(revoke_options).run + end + # @return [String] the url to authenticate as a Facebook user. def url HTTPRequest.new(url_options).url end @@ -40,9 +46,17 @@ {}.tap do |params| params[:client_id] = Fb.configuration.client_id params[:redirect_uri] = @redirect_uri params[:scope] = 'email,pages_show_list,read_insights' end + end + + def revoke_options + {path: '/v2.9/me/permissions', method: :delete, params: revoke_params} + end + + def revoke_params + {access_token: @refresh_token} end def fetch_access_token_with(params) params = params.merge access_token_params request = HTTPRequest.new path: '/oauth/access_token', params: params