From 9163c8ad843d566d5b3cb0a29248f5c0fa14f8c8 Mon Sep 17 00:00:00 2001 From: Olusesan Ameye Date: Sun, 3 Apr 2022 15:49:38 -0400 Subject: [PATCH] fix --- www/application/helpers/hybridauth_helper.php | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 www/application/helpers/hybridauth_helper.php diff --git a/www/application/helpers/hybridauth_helper.php b/www/application/helpers/hybridauth_helper.php new file mode 100644 index 00000000..29312c31 --- /dev/null +++ b/www/application/helpers/hybridauth_helper.php @@ -0,0 +1,88 @@ + site_url('login/auth/') , + + 'providers' => array( + 'Google' => array( + 'enabled' => true, + 'keys' => array( + 'id' => '817021856543-ad9nsjgdpsu2s2jrl63j3ihrv7lbf6ma.apps.googleusercontent.com', + 'secret' => 'aozK_2G8UjaCmLgPPkv9abIm' + ) , + 'scope' => 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile' + ) , + + 'Facebook' => array( + 'enabled' => true, + 'keys' => array( + 'id' => (ENVIRONMENT == 'development') ? '390204307987009' : '390204307987009', + 'secret' => (ENVIRONMENT == 'development') ? '19f778e312f2ab96d147bacb612910c2' : '19f778e312f2ab96d147bacb612910c2' + ) , + 'scope' => 'email, public_profile' + ) , + + 'Apple' => array( + "enabled" => true, + "keys" => [ + "id" => "Your Apple ID", + "team_id" => "Your Apple team id", + "key_id" => "Your Apple key id", + "key_content" => "Your Apple key (content including BEGIN and END lines)", + "key_file" => "Full path to your Apple key file (alternative to key_content)" + ], + "scope" => "name email", + "verifyTokenSignature" => true + ) + ) , + + 'hybrid_debug' => array( + 'debug_mode' => 'info', /* none, debug, info, error */ + 'debug_file' => APPPATH . '/logs/log-' . date('Y-m-d') . '.php' + ) + ); + + return $config; + } +} + +if ( ! function_exists('get_hybridauth_links')) +{ + function get_hybridauth_links($hybrid, $router) + { + $login_links = array(); + + //Get enabled providers array + $providers = $hybrid->getProviders(); + + $provider_icons = array( + 'Apple' => '/site3/assets/media/svg/brand-logos/apple-black.svg', + 'Facebook' => '/site3/assets/media/svg/brand-logos/facebook-4.svg', + 'Google' => '/site3/assets/media/svg/brand-logos/google-icon.svg' + ); + + //List a link to login + foreach ($providers as $provider) + { + $login_links[$provider] = ""; + //$href = sprintf(base_url('%s/auth/%s/') , strtolower($router->fetch_class()) , $provider); + $href = sprintf("%s/%s/", site_url('login/auth'), $provider); + $login_links[$provider] = $href; // .= ''; + if (array_key_exists($provider, $provider_icons)) { + // $login_links[$provider] .= 'Logo'; + } + // $login_links[$provider] .= 'Continue with ' . $provider . ''; + } + + return $login_links; + } +} + + +