Faker::Omniauth
Available since version 1.8.0.
Omniauth is a library that standardizes multi-provider authentication for web applications. Each of the following methods will return a randomized hash that mimics the hash returned by each of these omniauth strategies.
Faker::Omniauth.google #=>
{
:provider => "google_oauth2",
:uid => "123456789",
:info => {
:name => "John Doe",
:email => "[email protected]",
:first_name => "John",
:last_name => "Doe",
:image => "https://lh3.googleusercontent.com/url/photo.jpg"
},
:credentials => {
:token => "token",
:refresh_token => "another_token",
:expires_at => 1354920555,
:expires => true
},
:extra => {
:raw_info => {
:sub => "123456789",
:email => "[email protected]",
:email_verified => true,
:name => "John Doe",
:given_name => "John",
:family_name => "Doe",
:profile => "https://plus.google.com/123456789",
:picture => "https://lh3.googleusercontent.com/url/photo.jpg",
:gender => "male",
:birthday => "0000-06-25",
:locale => "en",
:hd => "example.com"
},
:id_info => {
"iss" => "accounts.google.com",
"at_hash" => "HK6E_P6Dh8Y93mRNtsDB1Q",
"email_verified" => "true",
"sub" => "10769150350006150715113082367",
"azp" => "APP_ID",
"email" => "[email protected]",
"aud" => "APP_ID",
"iat" => 1353601026,
"exp" => 1353604926,
"openid_id" => "https://www.google.com/accounts/o8/id?id=ABCdfdswawerSDFDsfdsfdfjdsf"
}
}
}
Faker::Omniauth.facebook #=>
{
provider: 'facebook',
uid: '1234567',
info: {
email: '[email protected]',
name: 'Joe Bloggs',
first_name: 'Joe',
last_name: 'Bloggs',
image: 'http://graph.facebook.com/1234567/picture?type=square',
verified: true
},
credentials: {
token: 'ABCDEF...',
expires_at: 1321747205,
expires: true
},
extra: {
raw_info: {
id: '1234567',
name: 'Joe Bloggs',
first_name: 'Joe',
last_name: 'Bloggs',
link: 'http://www.facebook.com/jbloggs',
username: 'jbloggs',
location: { id: '123456789', name: 'Palo Alto, California' },
gender: 'male',
email: '[email protected]',
timezone: -8,
locale: 'en_US',
verified: true,
updated_time: '2011-11-11T06:21:03+0000',
}
}
}
Faker::Omniauth.twitter #=>
{
:provider => "twitter",
:uid => "123456",
:info => {
:nickname => "johnqpublic",
:name => "John Q Public",
:location => "Anytown, USA",
:image => "http://si0.twimg.com/sticky/default_profile_images/default_profile_2_normal.png",
:description => "a very normal guy.",
:urls => {
:Website => nil,
:Twitter => "https://twitter.com/johnqpublic"
}
},
:credentials => {
:token => "a1b2c3d4...", # The OAuth 2.0 access token
:secret => "abcdef1234"
},
:extra => {
:access_token => "", # An OAuth::AccessToken object
:raw_info => {
:name => "John Q Public",
:listed_count => 0,
:profile_sidebar_border_color => "181A1E",
:url => nil,
:lang => "en",
:statuses_count => 129,
:profile_image_url => "http://si0.twimg.com/sticky/default_profile_images/default_profile_2_normal.png",
:profile_background_image_url_https => "https://twimg0-a.akamaihd.net/profile_background_images/229171796/pattern_036.gif",
:location => "Anytown, USA",
:time_zone => "Chicago",
:follow_request_sent => false,
:id => 123456,
:profile_background_tile => true,
:profile_sidebar_fill_color => "666666",
:followers_count => 1,
:default_profile_image => false,
:screen_name => "",
:following => false,
:utc_offset => -3600,
:verified => false,
:favourites_count => 0,
:profile_background_color => "1A1B1F",
:is_translator => false,
:friends_count => 1,
:notifications => false,
:geo_enabled => true,
:profile_background_image_url => "http://twimg0-a.akamaihd.net/profile_background_images/229171796/pattern_036.gif",
:protected => false,
:description => "a very normal guy.",
:profile_link_color => "2FC2EF",
:created_at => "Thu Jul 4 00:00:00 +0000 2013",
:id_str => "123456",
:profile_image_url_https => "https://si0.twimg.com/sticky/default_profile_images/default_profile_2_normal.png",
:default_profile => false,
:profile_use_background_image => false,
:entities => {
:description => {
:urls => []
}
},
:profile_text_color => "666666",
:contributors_enabled => false
}
}
}
Faker::Omniauth.linkedin #=>
{
"provider"=>"linkedin",
"uid"=>"AbC123",
"info"=> {
"name"=>"John Doe",
"email"=>"[email protected]",
"nickname"=>"John Doe",
"first_name"=>"John",
"last_name"=>"Doe",
"location"=>"Greater Boston Area, US",
"description"=>"Senior Developer, Hammertech",
"image"=> "http://m.c.lnkd.licdn.com/mpr/mprx/0_aBcD...",
"phone"=>"null",
"headline"=> "Senior Developer, Hammertech",
"industry"=>"Internet",
"urls"=>{
"public_profile"=>"http://www.linkedin.com/in/johndoe"
}
},
"credentials"=> {
"token"=>"12312...",
"secret"=>"aBc..."
},
"extra"=>
{
"access_token"=> {
"token"=>"12312...",
"secret"=>"aBc...",
"consumer"=>nil, #<OAuth::Consumer>
"params"=> {
:oauth_token=>"12312...",
:oauth_token_secret=>"aBc...",
:oauth_expires_in=>"5183999",
:oauth_authorization_expires_in=>"5183999",
},
"response"=>nil #<Net::HTTPResponse>
},
"raw_info"=> {
"firstName"=>"Joe",
"headline"=>"Senior Developer, Hammertech",
"id"=>"AbC123",
"industry"=>"Internet",
"lastName"=>"Doe",
"location"=> {"country"=>{"code"=>"us"}, "name"=>"Greater Boston Area"},
"pictureUrl"=> "http://m.c.lnkd.licdn.com/mpr/mprx/0_aBcD...",
"publicProfileUrl"=>"http://www.linkedin.com/in/johndoe"
}
}
}
Faker::Omniauth.github #=>
{
:provider =>"github",
:uid =>"95144751",
:info => {
:nickname => "jackson-keeling",
:email => "[email protected]",
:name => "Jackson Keeling",
:image => "https://via.placeholder.com/300x300.png",
:urls => {
:GitHub => "https://github.com/jackson-keeling"
}
},
:credentials => {
:token => "9ea49b946a31b705a0168295a0caa195",
:expires => false
},
:extra => {
:raw_info => {
:login => "jackson-keeling",
:id => "95144751",
:avatar_url => "https://via.placeholder.com/300x300.png",
:gravatar_id => "",
:url => "https://api.github.com/users/jackson-keeling",
:html_url => "https://github.com/jackson-keeling",
:followers_url => "https://api.github.com/users/jackson-keeling/followers",
:following_url => "https://api.github.com/users/jackson-keeling/following{/other_user}",
:gists_url => "https://api.github.com/users/jackson-keeling/gists{/gist_id}",
:starred_url => "https://api.github.com/users/jackson-keeling/starred{/owner}{/repo}",
:subscriptions_url => "https://api.github.com/users/jackson-keeling/subscriptions",
:organizations_url => "https://api.github.com/users/jackson-keeling/orgs",
:repos_url => "https://api.github.com/users/jackson-keeling/repos",
:events_url => "https://api.github.com/users/jackson-keeling/events{/privacy}",
:received_events_url => "https://api.github.com/users/jackson-keeling/received_events",
:type => "User",
:site_admin => true,
:name => "Jackson Keeling",
:company => nil,
:blog => nil,
:location => "Paigeton, Massachusetts",
:email => "[email protected]",
:hireable => nil,
:bio => nil,
:public_repos => 263,
:public_gists => 658,
:followers => 294,
:following => 865,
:created_at => "2017-03-10T19:49:54+03:00",
:updated_at => "2017-04-04T10:32:08+03:00"
}
}
}
Faker::Omniauth.apple #=>
{
:provider => "apple",
:uid => "529731.75429b71301caccc750a77b9369d2bc5.7027",
:info => {
:sub => "529731.75429b71301caccc750a77b9369d2bc5.7027",
:email => "[email protected]",
:first_name => "Robert",
:last_name => "Kirlin"
},
:credentials => {
:token => "ba6089c326c800190b88746f8a2e13f7",
:refresh_token => "ebcdb693d801c5055fe62ff37b48c3b6",
:expires_at => 1579805533,
:expires => true
},
:extra => {
:raw_info => {
:iss => "https://appleid.apple.com",
:aud => "CLIENT_ID",
:exp => 1591575417,
:iat => 1571433587,
:sub => "529731.75429b71301caccc750a77b9369d2bc5.7027",
:at_hash => "d8bc8da580222598bba9da1470ad7b94",
:auth_time => 1583778038,
:email => "[email protected]",
:email_verified => true
}
}
}
Faker::Omniauth.auth0 #=>
{
:provider => "auth0",
:uid => "auth0|d0584e3ab2d3816be9518a56",
:info=> {
:name => "auth0|d0584e3ab2d3816be9518a56",
:nickname => "Thurman DuBuque",
:email => "[email protected]",
:image => "https://via.placeholder.com/300x300.png"
},
:credentials=> {
:expires_at => 1654345109,
:expires => true,
:token_type => "Bearer",
:id_token=> "fcc25a5b606dbf3211b792b634cf92f3857da4cce725a019b2c492c4845fd63f",
:token => "8e668c5b994f3bfc38e3067e6ed960c5",
:refresh_token => "19f82075f7c69133452614bd177f4380"
},
:extra=> {
:raw_info=> {
:email => "[email protected]",
:email_verified => true,
:iss => "https://auth0.com/",
:sub => "auth0|d0584e3ab2d3816be9518a56",
:aud => "Auth012345",
:iat => 1663896480,
:exp => 1640375502
}
}
}