disableRequireCodeChallengeForPublicClients(); $authServer->enableGrantType($authCodeGrant, $accessTokenTTL); $authCodeGrant->setScopeRepository($publicScopesRepo); // Change repository after enabling $refreshTokenGrant = new Grants\RefreshTokenGrant($refreshTokensRepo); $authServer->enableGrantType($refreshTokenGrant, $accessTokenTTL); $refreshTokenGrant->setScopeRepository($publicScopesRepo); // Change repository after enabling $clientCredentialsGrant = new Grants\ClientCredentialsGrant(); $authServer->enableGrantType($clientCredentialsGrant, $accessTokenTTL); $clientCredentialsGrant->setScopeRepository($internalScopesRepo); // Change repository after enabling $verificationUri = Yii::$app->request->getHostInfo() . '/code'; $deviceCodeGrant = new Grants\DeviceCodeGrant($deviceCodesRepo, $refreshTokensRepo, new DateInterval('PT10M'), $verificationUri); $deviceCodeGrant->setIntervalVisibility(true); $authServer->enableGrantType($deviceCodeGrant, $accessTokenTTL); $deviceCodeGrant->setScopeRepository($publicScopesRepo); // Change repository after enabling return $authServer; } }