<repo_name>ProgrammedMikey/Pinterest-clone<file_sep>/app/Http/Controllers/SocialAuthController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\SocialAccountService;
use Socialite; // socialite namespace
use JWTAuth;
class SocialAuthController extends Controller
{
    // redirect function
    public function redirect(){
        return Socialite::driver('facebook')->redirect();
    }
    // callback function
    public function callback(SocialAccountService $service){
        // when facebook call us a with token
        $user = $service->createOrGetUser(Socialite::driver('facebook')->user());
        $token = JWTAuth::fromUser($user);
//        dd($token);
        return response()->json(['token' => $token]);
//        return redirect()->to('http://localhost:8080?' . 'token=' . $token);
    }
}<file_sep>/readme.md
# Pinterest Clone

### Live Version:
https://mdasilva-pinterest.herokuapp.com/


## User stories: 

  - As an authenticated user, I can link to images.
  - As an authenticated user, I can delete images that I've linked to.
  - As an authenticated user, I can see a Pinterest-style wall of all the images I've linked to.
  - As an unauthenticated user, I can browse other users' walls of images.
  - As an authenticated user, if I upload an image that is broken, it will be replaced by a placeholder image.
