File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -342,20 +342,23 @@ private function getPostedToken(RequestInterface $request): ?string
342342 assert ($ request instanceof IncomingRequest);
343343
344344 // Does the token exist in POST, HEADER or optionally php:://input - json data.
345+
346+ if ($ tokenValue = $ request ->getPost ($ this ->tokenName )) {
347+ return $ tokenValue ;
348+ }
349+
345350 if ($ request ->hasHeader ($ this ->headerName ) && ! empty ($ request ->header ($ this ->headerName )->getValue ())) {
346- $ tokenName = $ request ->header ($ this ->headerName )->getValue ();
347- } else {
348- $ body = (string ) $ request ->getBody ();
349- $ json = json_decode ($ body );
351+ return $ request ->header ($ this ->headerName )->getValue ();
352+ }
350353
351- if ( $ body !== '' && ! empty ( $ json ) && json_last_error () === JSON_ERROR_NONE ) {
352- $ tokenName = $ json ->{ $ this -> tokenName } ?? null ;
353- } else {
354- $ tokenName = null ;
355- }
354+ $ body = ( string ) $ request -> getBody ();
355+ $ json = json_decode ( $ body ) ;
356+
357+ if ( $ body !== '' && ! empty ( $ json ) && json_last_error () === JSON_ERROR_NONE ) {
358+ return $ json ->{ $ this -> tokenName } ?? null ;
356359 }
357360
358- return $ request -> getPost ( $ this -> tokenName ) ?? $ tokenName ;
361+ return null ;
359362 }
360363
361364 /**
You can’t perform that action at this time.
0 commit comments