Skip to content

Instantly share code, notes, and snippets.

@akase244
akase244 / EngineersBlog-oauth1-client-Twitter.php
Created Aug 5, 2017
oauth1-client/src/Client/Server/Twitter.php
View EngineersBlog-oauth1-client-Twitter.php
<?php
/**
* {@inheritDoc}
*/
public function urlUserDetails()
{
return 'https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true';
}
View EngineersBlog-LaravelSocialite-GithubProvider.php
<?php
/**
* The scopes being requested.
*
* @var array
*/
protected $scopes = ['user:email'];
View EngineersBlog-LaravelSocialite-FacebookProvider.php
<?php
/**
* The scopes being requested.
*
* @var array
*/
protected $scopes = ['email'];
@akase244
akase244 / EngineersBlog-LaravelSocialite-OauthController-getEmail.php
Last active Aug 5, 2017
app/Http/Controllers/Auth/OauthController.php
View EngineersBlog-LaravelSocialite-OauthController-getEmail.php
<?php
public function handleProviderCallback($provider)
{
$oauthUser = Socialite::driver($provider)->user();
dd($oauthUser->getEmail());
}
View EngineersBlog-GoogleAnalytics-helpers.php
<?php
if (! function_exists('notify_to_analytics')) {
function notify_to_analytics($target_page)
{
$params = [];
$params['v'] = '1';
$params['t'] = 'pageview';
$params['tid'] = 'UA-XXXXXXXX-XX';
$params['cid'] = sprintf(
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
View EngineersBlog-LaravelSocialite-SocialiteServiceProvider.php
<?php
namespace App\Socialite;
use Laravel\Socialite\SocialiteServiceProvider as OriginalSocialiteServiceProvider;
class SocialiteServiceProvider extends OriginalSocialiteServiceProvider
{
public function register()
{
View EngineersBlog-LaravelSocialite-SocialiteManager.php
<?php
namespace App\Socialite;
use Laravel\Socialite\SocialiteManager as OriginalSocialiteManager;
class SocialiteManager extends OriginalSocialiteManager
{
protected function createFacebookDriver()
{
View EngineersBlog-LaravelSocialite-FacebookProvider.php
<?php
namespace App\Providers;
use Laravel\Socialite\Two\FacebookProvider as OriginalFacebookProvider;
class FacebookProvider extends OriginalFacebookProvider
{
protected function getUserByToken($token)
{
@akase244
akase244 / EngineersBlog-LaravelSocialite-FacebookProvider.php
Last active Aug 30, 2016
laravel/socialite/src/Two/FacebookProvider.php
View EngineersBlog-LaravelSocialite-FacebookProvider.php
protected function getUserByToken($token)
{
$meUrl = $this->graphUrl.'/'.$this->version.'/me?access_token='.$token.'&fields='.implode(',', $this->fields);
if (! empty($this->clientSecret)) {
$appSecretProof = hash_hmac('sha256', $token, $this->clientSecret);
$meUrl .= '&appsecret_proof='.$appSecretProof;
}
You can’t perform that action at this time.