Skip to content

Instantly share code, notes, and snippets.

@kingpabel
Last active March 12, 2016 22:07
Show Gist options
  • Save kingpabel/d17a0787ef96ca56cebc to your computer and use it in GitHub Desktop.
Save kingpabel/d17a0787ef96ca56cebc to your computer and use it in GitHub Desktop.
<?php
Route::post(‘oauth/access_token’, function() {
return Response::json(Authorizer::issueAccessToken());
});
Route::group(['middleware' => ['oauth']], function () {
Route::get('api', function () {
$user_id = Authorizer::getResourceOwnerId(); // the token user_id
$user = \App\User::find($user_id);// get the user data from database
return Response::json($user);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment