From 11f6a8ded5b1948723886f2e5413b91139fcce6b Mon Sep 17 00:00:00 2001 From: Joey Janson Date: Wed, 1 Feb 2023 09:54:49 +0100 Subject: [PATCH] feat: remove consent prompt on request (#969) --- Provider.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Provider.php b/Provider.php index 5b3d783..58483aa 100644 --- a/Provider.php +++ b/Provider.php @@ -18,6 +18,11 @@ class Provider extends AbstractProvider 'email', ]; + /** + * {@inheritdoc} + */ + protected $consent = false; + /** * {@inheritdoc} */ @@ -34,6 +39,32 @@ protected function getAuthUrl($state) ); } + /** + * {@inheritdoc} + */ + protected function getCodeFields($state = null) + { + $fields = parent::getCodeFields($state); + + if (!$this->consent) { + $fields['prompt'] = 'none'; + } + + return $fields; + } + + /** + * Prompt for consent each time or not. + * + * @return $this + */ + public function withConsent() + { + $this->consent = true; + + return $this; + } + /** * {@inheritdoc} */