本文整理汇总了PHP中OAuth::authorize方法的典型用法代码示例。如果您正苦于以下问题:PHP OAuth::authorize方法的具体用法?PHP OAuth::authorize怎么用?PHP OAuth::authorize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OAuth
的用法示例。
在下文中一共展示了OAuth::authorize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
use SocialNorm\Exceptions\ApplicationRejectedException;
use SocialNorm\Exceptions\InvalidAuthorizationCodeException;
use App\User;
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Route::get('/', 'ItemController@index');
Route::get('woj/{woj}', 'ItemController@showPowiaty');
Route::get('woj/{woj}/pow/{pow}', 'ItemController@showGminy');
Route::get('woj/{woj}/pow/{pow}/gmi/{gmi}', 'ItemController@showGmina');
Route::any('/search', 'SearchController@search');
Route::get('facebook/authorize', function () {
return OAuth::authorize('facebook');
});
Route::get('google/authorize', function () {
return OAuth::authorize('google');
});
Route::get('facebook/login', 'SocialController@facebookLogin');
Route::get('google/redirect', 'SocialController@googleRedirect');
Route::any('autocomplete/', 'SearchController@autocomplete');
Route::get('podmiot/{slug}', 'ItemController@showItem');
// Route that handles submission of review - rating/comment
Route::post('podmiot/{slug}', array('before' => 'csrf', 'ReviewController@addReview'));
示例2: function
]);*/
/*Route::get('patterns',[
'uses' => 'PatternController@latest',
'as' => 'patterns'
]);*/
use App\Models\patterns\Category;
use App\Models\patterns\Subcategory;
Route::get('/', ['as' => 'patterns.latest', 'uses' => 'home\\PatternController@latest']);
Route::get('/populares', ['as' => 'patterns.popular', 'uses' => 'home\\PatternController@popular']);
Route::get('/pendientes', ['as' => 'patterns.open', 'uses' => 'home\\PatternController@open']);
Route::get('/pending', ['as' => 'patterns.pending', 'uses' => 'home\\PatternController@pending']);
Route::get('/tutoriales', ['as' => 'patterns.closed', 'uses' => 'home\\PatternController@closed']);
Route::get('/solicitud/{id}', ['as' => 'patterns.details', 'uses' => 'home\\PatternController@details']);
// Authentication Social routes ...
Route::get('{provider}/authorize', function ($provider) {
return OAuth::authorize($provider);
});
Route::get('{provider}/login', function ($provider) {
OAuth::login($provider, function ($user, $userDetails) {
$user->username = $userDetails->nickname;
$user->email = $userDetails->email;
$user->save();
});
return view('admin/dashboard');
});
// Authentication routes ...
Route::get('login', ['uses' => 'Auth\\AuthController@getLogin', 'as' => 'login']);
Route::post('login', 'Auth\\AuthController@postLogin');
Route::get('logout', ['uses' => 'Auth\\AuthController@getLogout', 'as' => 'logout']);
// Registration routes ...
Route::get('register', ['uses' => 'Auth\\AuthController@getRegister', 'as' => 'register']);
示例3: linkedInAuthorize
public function linkedInAuthorize()
{
return OAuth::authorize('linkedin');
}
示例4: function
*/
use App\User;
Route::get('/', function () {
if (Auth::check()) {
if (Auth::user()->password == "") {
return view('home.registro');
}
if (Auth::user()->password != "") {
return view('inicio.inicio');
}
} else {
return view('home.home');
}
});
Route::get('auth', function () {
return OAuth::authorize('facebook');
});
Route::get('logout', array('as' => 'logout', function () {
}))->before('auth');
Route::get('login', function () {
try {
OAuth::login('facebook', function ($user, $details) {
$exist = User::where('email', $details->email)->first();
if ($exist) {
$user = $exist;
}
$user->name = $details->full_name;
$user->email = $details->email;
$user->provider_user_id = $details->id;
return $user;
});