Skip to content
Browse files

Check for nil fields in YouTube's user info response

  • Loading branch information...
1 parent f1c6ccc commit d555a775446dba621e9be69c9a6d922eda78642b @jamiew jamiew committed
Showing with 5 additions and 5 deletions.
  1. +5 −5 oa-oauth/lib/omniauth/strategies/you_tube.rb
View
10 oa-oauth/lib/omniauth/strategies/you_tube.rb
@@ -38,11 +38,11 @@ def user_info
{
'uid' => entry['id']['$t'],
'nickname' => entry['author'].first['name']['$t'],
- 'first_name' => entry['yt$firstName']['$t'],
- 'last_name' => entry['yt$lastName']['$t'],
- 'image' => entry['media$thumbnail']['url'],
- 'description' => entry['yt$description']['$t'],
- 'location' => entry['yt$location']['$t']
+ 'first_name' => entry['yt$firstName'] && entry['yt$firstName']['$t'],
+ 'last_name' => entry['yt$lastName'] && entry['yt$lastName']['$t'],
+ 'image' => entry['media$thumbnail'] && entry['media$thumbnail']['url'],
+ 'description' => entry['yt$description'] && entry['yt$description']['$t'],
+ 'location' => entry['yt$location'] && entry['yt$location']['$t']
}
end

0 comments on commit d555a77

Please sign in to comment.
Something went wrong with that request. Please try again.