Skip to content

Commit 16d415c

Browse files
committed
✨ OAuth2::AccessToken#refresh supports block param
1 parent f5885de commit 16d415c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/oauth2/access_token.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ def expired?
175175
#
176176
# @return [AccessToken] a new AccessToken
177177
# @note options should be carried over to the new AccessToken
178-
def refresh(params = {}, access_token_opts = {})
179-
raise("A refresh_token is not available") unless refresh_token
178+
def refresh(params = {}, access_token_opts = {}, &block)
179+
raise OAuth2::Error.new({error: "A refresh_token is not available"}) unless refresh_token
180180

181181
params[:grant_type] = "refresh_token"
182182
params[:refresh_token] = refresh_token
183-
new_token = @client.get_token(params, access_token_opts)
183+
new_token = @client.get_token(params, access_token_opts, &block)
184184
new_token.options = options
185185
if new_token.refresh_token
186186
# Keep it if there is one

0 commit comments

Comments
 (0)