Skip to content

Commit

Permalink
新增laravel发布配置
Browse files Browse the repository at this point in the history
  • Loading branch information
pl1998 committed Apr 19, 2021
1 parent 642d0cf commit c0dd020
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ composer.lock
.subsplit
.php_cs.cache
test.php
test
tests
src/Handle/AlipayOauth.php
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ use Pl1998\ThirdpartyOauth\SocialiteAuth;

$api = new SocialiteAuth([
'client_id' => '74ee75f10437b4862d653a682111e5ddca1d24422f00ec884453ad232ae07ac9',
'redirect_uri' => 'http://oauth.test/test.php',
'redirect_uri' => 'http://oauth.tests/tests.php',
'client_secret'=>''
]);

Expand All @@ -131,7 +131,7 @@ use Pl1998\ThirdpartyOauth\SocialiteAuth;

$api = new SocialiteAuth([
'client_id' => '74ee75f10437b4862d653a682111e5ddca1d24422f00ec884453ad232ae07ac9',
'redirect_uri' => 'http://oauth.test/test.php',
'redirect_uri' => 'http://oauth.tests/tests.php',
'client_secret' => ''
]);

Expand Down Expand Up @@ -162,7 +162,7 @@ Route::get('gitee/callback','api/TestController/giteeCallback')->name('授权回
return [
'github' => [
'client_id' => '2365a07a73dc25a27e5c7a968248b96beb53a1ad300de7ba6bf4ffe247a4b386',
'redirect_uri' => 'http://test.test/gitee/callback',
'redirect_uri' => 'http://tests.tests/gitee/callback',
'client_secret' => ''
]
];
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pl1998/thirdparty_oauth",
"description": "这是一个第三方授权登录扩展包 目前支持github gitlab gitee 授权登录",
"description": "这是一个第三方授权登录扩展包。目前支持GITHUB、GITEE、谷歌、微博、微信、QQ等授权登录",
"license": "MIT",
"authors": [
{
Expand Down
27 changes: 27 additions & 0 deletions config/oauth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* Created By PhpStorm.
* User : Latent
* Date : 2021/4/9
* Time : 5:01 下午
**/

//其他平台请保持参数一致 microsoft 注意还有这个参数 region
return [

'github' => [
'client_id'=>env('GITHUB_CLIENT_ID',''),
'redirect_uri'=>env('GITHUB_CALLBACK',''),
'client_secret'=>env('GITHUB_SECRET',''),
],
'gitee' => [
'client_id'=>env('GITEE_CLIENT_ID',''),
'redirect_uri'=>env('GITEE_CALLBACK',''),
'client_secret'=>env('GITEE_SECRET',''),
],
'weibo' => [
'client_id'=>env('WEIBO_CLIENT_ID',''),
'redirect_uri'=>env('WEIBO_CALLBACK',''),
'client_secret'=>env('WEIBO_SECRET',''),
]
];
2 changes: 1 addition & 1 deletion src/Handle/GiteeOauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function authorization()
'client_id' => $this->config['client_id'],
'redirect_uri' => $this->config['redirect_uri'],
'response_type' => 'code',
]);
]);//Car

$url = $url.'?'.http_build_query($query);

Expand Down
11 changes: 10 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
protected $defer = true;

public function boot()
{
$this->publishes([
__DIR__ . '/../config/oauth.php' => config_path('oauth.php'),'oauth'
]);
}

public function register()
{
$this->app->singleton(SocialiteAuth::class, function ($app) {
return new SocialiteAuth(config('services.$oauth'));
return new SocialiteAuth(config('oauth'));
});

$this->app->alias(SocialiteAuth::class, 'SocialiteAuth');
Expand All @@ -32,4 +39,6 @@ public function provides()
{
return [SocialiteAuth::class, 'SocialiteAuth'];
}


}

0 comments on commit c0dd020

Please sign in to comment.