def google
uid = Number.number(9)
auth = Omniauth.new()
email = "#{auth.first_name.downcase}@example.com"
{
provider: "google_oauth2",
uid: uid,
info: {
name: auth.name,
first_name: auth.first_name,
last_name: auth.last_name,
email: email,
image: image
},
credentials: {
token: Crypto.md5,
refresh_token: Crypto.md5,
expires_at: one_hour_from_now.to_i,
expires: true
},
extra: {
raw_info: {
sub: uid,
email: email,
email_verified: random_boolean,
name: auth.name,
given_name: auth.first_name,
family_name: auth.last_name,
profile: "https://plus.google.com/#{uid}",
picture: image,
gender: ["male", "female"].shuffle.pop,
birthday: Date.backward(36400).strftime("%Y-%m-%d"),
local: "en",
hd: "#{Company.name.downcase}.com"
},
},
id_info: {
"iss" => "accounts.google.com",
"at_hash" => Crypto.md5,
"email_verified" => "true",
"sub" => Number.number(28).to_s,
"azp" => "APP_ID",
"email" => email,
"aud" => "APP_ID",
"iat" => Number.number(10),
"exp" => one_hour_from_now.to_i.to_s,
"openid_id" => "https://www.google.com/accounts/o8/id?id=#{uid}"
}
}
end