arm092 / youtuber-for-laravel

The package will help you to upload videos to youtube with privacy parameter
MIT License
7 stars 4 forks source link

i have an error #4

Open Solovic2 opened 4 years ago

Solovic2 commented 4 years ago

hello sir , when i use first step when i call youtube/auth , after signing in , it redirect back and show me this error

Capture

the error is : " GuzzleHttp\Exception\ClientException Client error: POST https://oauth2.googleapis.com/token resulted in a 400 Bad Request response: { "error": "redirect_uri_mismatch", "error_description": "Bad Request" } " .

i put the second route with method ( callback ) and the error i think from third line

public function callback(Request $request){

    $redirect_url ='http://localhost/proj/public/youtube/callback';
    $video = puplic_path('video\1.mp4');    // i made a folder called video and put one from my computer

> $youtube = Youtube::setRedirectUrl($redirect_url)->upload($video,[]);`

    // Get uploaded video id
    return   $video_id = $youtube->uploadedVideoId();
}

what should i do ?

thanks sir .

arm092 commented 4 years ago

Hi dear Go to your Google Developers Console > Then go to API Manager > Click on the Credentials > Go to your Web Client Service. You'll see clientid and client secret. Below there somewhere you'll find Authorized redirect URI. Just add your redirect uri for eg. `www.example.com/oauth'. Now google will use one of the listed redirect uri. It will fix your problem.

It is not package's problem. Try to search problem solving on the stackoverflow.

Solovic2 commented 4 years ago

thanks sir for replying , i'm beginner with laravel so please care of me , i did what u wrote , but same problem with me , it send with my url in request { code & scope &state } after i sign in , but when use callback function which upload video , it says same thing which i put above .

my try is :

making clientId ,client secret .

save , and put it in my env file .

make Authorized redirect URI >> http://localhost/proj/public/myown .

run composer require arm092/laravel-youtuber .

in my view i put Route::get('youtube/auth', 'YoutubeUploaderController@auth'); Route::get('youtube/callback', 'YoutubeUploaderController@callback'); `

in my controler ( YoutubeUploaderController ) i make methods.

in my web site , i run http://localhost/proj/public/youtube/auth and signing in ,it redirect to http://localhost/proj/public/myown/... with request ( code=.. & scope=.. & state=.. ) , but , it show me same problem i tried to make another route and view with form to submit from that link http://localhost/proj/public/myown/... , it says i should be authorized .

so what i should to do ?

I hope i didn't disturb you , thanks sir.