diff --git a/.env.example b/.env.example index 5d7ea15f8..c353bc49b 100644 --- a/.env.example +++ b/.env.example @@ -134,8 +134,8 @@ MFA_ENABLED=true DAV_ENABLED=true # CLIENT ID and SECRET used for OAuth authentication -PASSPORT_PERSONAL_ACCESS_CLIENT_ID= -PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET= +PASSPORT_PASSWORD_GRANT_CLIENT_ID= +PASSPORT_PASSWORD_GRANT_CLIENT_SECRET= # Allow to access general statistics about your instance through a public API # call diff --git a/app/Http/Controllers/Api/Auth/OAuthController.php b/app/Http/Controllers/Api/Auth/OAuthController.php index d3c7390ce..8458f664c 100644 --- a/app/Http/Controllers/Api/Auth/OAuthController.php +++ b/app/Http/Controllers/Api/Auth/OAuthController.php @@ -194,8 +194,8 @@ class OAuthController extends Controller /** @var \Illuminate\Http\Response */ $response = app(Kernel::class)->handle(Request::create($url, 'POST', [ 'grant_type' => $data['grantType'], - 'client_id' => config('passport.personal_access_client.id'), - 'client_secret' => config('passport.personal_access_client.secret'), + 'client_id' => config('passport.password_grant_client.id'), + 'client_secret' => config('passport.password_grant_client.secret'), 'username' => $data['username'], 'password' => $data['password'], 'scope' => '', diff --git a/config/passport.php b/config/passport.php index 417f89a8e..60d7ee206 100644 --- a/config/passport.php +++ b/config/passport.php @@ -44,8 +44,22 @@ $passports = [ */ 'personal_access_client' => [ - 'id' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_ID', env('MOBILE_CLIENT_ID')), - 'secret' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET', env('MOBILE_CLIENT_SECRET')), + 'id' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_ID'), + 'secret' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET'), + ], + + /* + |-------------------------------------------------------------------------- + | Password Grant Client + |-------------------------------------------------------------------------- + | + | Password grant client used for oauth login, and mobile application. + | + */ + + 'password_grant_client' => [ + 'id' => env('PASSPORT_PASSWORD_GRANT_CLIENT_ID', env('MOBILE_CLIENT_ID')), + 'secret' => env('PASSPORT_PASSWORD_GRANT_CLIENT_SECRET', env('MOBILE_CLIENT_SECRET')), ], /* diff --git a/docs/installation/providers/generic.md b/docs/installation/providers/generic.md index 628843cc3..96bee0ccf 100644 --- a/docs/installation/providers/generic.md +++ b/docs/installation/providers/generic.md @@ -300,8 +300,8 @@ Client secret: zsfOHGnEbadlBP8kLsjOV8hMpHAxb0oAhenfmSqq - Copy the two values into two new environment variables of your `.env` file: - - The value of `Client ID` in a `PASSPORT_PERSONAL_ACCESS_CLIENT_ID` variable - - The value of `Client secret` in a `PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET` variable + - The value of `Client ID` in a `PASSPORT_PASSWORD_GRANT_CLIENT_ID` variable + - The value of `Client secret` in a `PASSPORT_PASSWORD_GRANT_CLIENT_SECRET` variable - OAuth login can be access on `http://localhost/oauth/login`. diff --git a/docs/installation/providers/heroku.md b/docs/installation/providers/heroku.md index 1eff9bca7..c214c4815 100644 --- a/docs/installation/providers/heroku.md +++ b/docs/installation/providers/heroku.md @@ -97,8 +97,8 @@ Client secret: zsfOHGnEbadlBP8kLsjOV8hMpHAxb0oAhenfmSqq ``` * Copy the two values into two new environment variable of your `.env` file: - - The value of client ID in a `PASSPORT_PERSONAL_ACCESS_CLIENT_ID` variable - - The value of client secret in a `PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET` variable + - The value of client ID in a `PASSPORT_PASSWORD_GRANT_CLIENT_ID` variable + - The value of client secret in a `PASSPORT_PASSWORD_GRANT_CLIENT_SECRET` variable ## Limitations diff --git a/tests/Browser/Auth/AuthControllerTest.php b/tests/Browser/Auth/AuthControllerTest.php index 528eb31c1..3f9d1f361 100644 --- a/tests/Browser/Auth/AuthControllerTest.php +++ b/tests/Browser/Auth/AuthControllerTest.php @@ -42,8 +42,8 @@ class AuthControllerTest extends TestCase ); $this->setEnvironmentValue([ - 'PASSPORT_PERSONAL_ACCESS_CLIENT_ID' => $client->id, - 'PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET' => $client->secret, + 'PASSPORT_PASSWORD_GRANT_CLIENT_ID' => $client->id, + 'PASSPORT_PASSWORD_GRANT_CLIENT_SECRET' => $client->secret, ]); $userPassword = 'password'; @@ -79,8 +79,8 @@ class AuthControllerTest extends TestCase ); $this->setEnvironmentValue([ - 'PASSPORT_PERSONAL_ACCESS_CLIENT_ID' => $client->id, - 'PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET' => $client->secret, + 'PASSPORT_PASSWORD_GRANT_CLIENT_ID' => $client->id, + 'PASSPORT_PASSWORD_GRANT_CLIENT_SECRET' => $client->secret, ]); $userPassword = 'password'; @@ -135,8 +135,8 @@ class AuthControllerTest extends TestCase ); $this->setEnvironmentValue([ - 'PASSPORT_PERSONAL_ACCESS_CLIENT_ID' => $client->id, - 'PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET' => $client->secret, + 'PASSPORT_PASSWORD_GRANT_CLIENT_ID' => $client->id, + 'PASSPORT_PASSWORD_GRANT_CLIENT_SECRET' => $client->secret, ]); $userPassword = 'password';