Beispiel #1
0
        return Redirect::to('/');
    }
    return Response::view('oauth-confirm');
});
Route::get('/github/oauth', function () {
    if (GithubLogin::check()) {
        return Redirect::to('/');
    }
    return Redirect::to(GithubLogin::authorizeUrl());
});
Route::get('/logout', function () {
    $cookie = GithubLogin::logout();
    return Redirect::to('/github/oauth/confirm')->withCookie($cookie);
});
Route::get('/github/oauth/callback', function () {
    if (GithubLogin::check()) {
        return Redirect::to('/');
    }
    $code = Input::get('code');
    if ($code == '') {
        return 'CODE ERROR';
    }
    $accessToken = \Eleme\Github\GithubAuthorize::accessToken($code);
    if ($accessToken == NULL) {
        echo "CODE ERROR";
    }
    $client = new \Eleme\Github\GithubClient($accessToken);
    $teams = $client->request('user/teams');
    $haveEleme = false;
    $orgTeams = array();
    foreach ($teams as $team) {