Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ensure cached @client gets invalidated when refreshing OAuth2 token

  • Loading branch information...
commit fb63555e12d51eb39ca6946f4b95d9f46ca3301f 1 parent 458a43a
@yaauie yaauie authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/youtube_it/client.rb
View
8 lib/youtube_it/client.rb
@@ -438,7 +438,13 @@ def access_token
end
def refresh_access_token!
- @access_token = access_token.refresh!
+ new_access_token = access_token.refresh!
+ require 'thread' unless Thread.respond_to?(:exclusive)
+ Thread.exclusive do
+ @access_token = new_access_token
+ @client = nil
+ end
+ @access_token
end
def current_user
Please sign in to comment.
Something went wrong with that request. Please try again.