-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
508bac4
commit b329d75
Showing
7 changed files
with
534 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# :package_name | ||
# :Youtube Uploader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
/** | ||
* Client ID. | ||
*/ | ||
'client_id' => env('GOOGLE_CLIENT_ID', null), | ||
|
||
/** | ||
* Client Secret. | ||
*/ | ||
'client_secret' => env('GOOGLE_CLIENT_SECRET', null), | ||
|
||
/** | ||
* Scopes. | ||
*/ | ||
'scopes' => [ | ||
'https://www.googleapis.com/auth/youtube', | ||
'https://www.googleapis.com/auth/youtube.upload', | ||
'https://www.googleapis.com/auth/youtube.readonly' | ||
], | ||
|
||
/** | ||
* Route URI's | ||
*/ | ||
'routes' => [ | ||
|
||
/** | ||
* Determine if the Routes should be disabled. | ||
* Note: We recommend this to be set to "false" immediately after authentication. | ||
*/ | ||
'enabled' => false, | ||
|
||
/** | ||
* The prefix for the below URI's | ||
*/ | ||
'prefix' => 'youtube', | ||
|
||
/** | ||
* Redirect URI | ||
*/ | ||
'redirect_uri' => 'callback', | ||
|
||
/** | ||
* The autentication URI | ||
*/ | ||
'authentication_uri' => 'auth', | ||
|
||
/** | ||
* The redirect back URI | ||
*/ | ||
'redirect_back_uri' => '/', | ||
|
||
] | ||
|
||
]; |
32 changes: 32 additions & 0 deletions
32
migrations/2015_05_06_194030_create_youtube_access_tokens_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateYoutubeAccessTokensTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('youtube_access_tokens', function(Blueprint $table) | ||
{ | ||
$table->increments('id'); | ||
$table->text('access_token'); | ||
$table->timestamp('created_at'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop('youtube_access_tokens'); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/** | ||
* Route URI's | ||
*/ | ||
Route::group(['prefix' => config('youtube.routes.prefix')], function() { | ||
|
||
/** | ||
* Authentication | ||
*/ | ||
Route::get(config('youtube.routes.authentication_uri'), function() | ||
{ | ||
return redirect()->to(YoutubeUploader::createAuthUrl()); | ||
}); | ||
|
||
/** | ||
* Redirect | ||
*/ | ||
Route::get(config('youtube.routes.redirect_uri'), function(Illuminate\Http\Request $request) | ||
{ | ||
if(!$request->has('code')) { | ||
throw new Exception('$_GET[\'code\'] is not set. Please re-authenticate.'); | ||
} | ||
|
||
$token = YoutubeUploader::authenticate($request->get('code')); | ||
|
||
YoutubeUploader::saveAccessTokenToDB($token); | ||
|
||
return redirect(config('youtube.routes.redirect_back_uri', '/')); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.