← All changes
|
src/myyoast-client/application/oauth-grant-handler.php
+6
-1
27.9
→
trunk
View file →
| @@ -94,9 +94,14 @@ | ||
| 94 | 94 | * |
| 95 | 95 | * @throws Token_Request_Failed_Exception If the token request fails. |
| 96 | 96 | */ |
| 97 | 97 | public function request_token( Grant_Interface $grant, Resource_Indicator $resource_indicator ): Token_Set { |
| 98 | - $registered_client = $this->client_registration->ensure_registered(); | |
| 98 | + // A token request requires an existing registration; it never triggers DCR or a | |
| 99 | + // redirect-URI update — that is the connect flow's responsibility. | |
| 100 | + $registered_client = $this->client_registration->get_registered_client(); | |
| 101 | + if ( $registered_client === null ) { | |
| 102 | + throw new Token_Request_Failed_Exception( 'not_registered', 'Site is not registered with MyYoast; complete the connect flow first.' ); | |
| 103 | + } | |
| 99 | 104 | |
| 100 | 105 | try { |
| 101 | 106 | $token_endpoint = $this->discovery->get_document()->get_token_endpoint(); |
| 102 | 107 | } catch ( Discovery_Failed_Exception | Server_Capability_Exception $e ) { |