lib/omniauth/strategies/linkedin.rb in omniauth-linkedin-oauth2-1.0.0 vs lib/omniauth/strategies/linkedin.rb in omniauth-linkedin-oauth2-1.0.1

- old
+ new

@@ -40,11 +40,12 @@ alias :oauth2_access_token :access_token def access_token ::OAuth2::AccessToken.new(client, oauth2_access_token.token, { :expires_in => oauth2_access_token.expires_in, - :expires_at => oauth2_access_token.expires_at + :expires_at => oauth2_access_token.expires_at, + :refresh_token => oauth2_access_token.refresh_token }) end def raw_info @raw_info ||= access_token.get(profile_endpoint).parsed @@ -90,24 +91,18 @@ result << fields_mapping[field] if fields_mapping.has_key? field end end def localized_field field_name - return unless localized_field_available? field_name - - raw_info[field_name]['localized'][field_locale(field_name)] + raw_info.dig(*[field_name, 'localized', field_locale(field_name)]) end def field_locale field_name "#{ raw_info[field_name]['preferredLocale']['language'] }_" \ "#{ raw_info[field_name]['preferredLocale']['country'] }" end - def localized_field_available? field_name - raw_info[field_name] && raw_info[field_name]['localized'] - end - def picture_url return unless picture_available? picture_references.last['identifiers'].first['identifier'] end @@ -126,9 +121,15 @@ '/v2/emailAddress?q=members&projection=(elements*(handle~))' end def profile_endpoint "/v2/me?projection=(#{ fields.join(',') })" + end + + def token_params + super.tap do |params| + params.client_secret = options.client_secret + end end end end end