Method: Wechat::Token::AccessTokenBase#token

Defined in:
lib/wechat/token/access_token_base.rb

#tokenObject



16
17
18
19
20
21
# File 'lib/wechat/token/access_token_base.rb', line 16

def token
  # Possible two worker running, one worker refresh token, other unaware, so must read every time
  read_token_from_store
  refresh if remain_life_seconds < @random_generator.rand(30..(3 * 60))
  access_token
end