File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
wechaty-puppet-hostie/IO/Github/Wechaty/PuppetHostie Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -775,13 +775,26 @@ private function _startGrpcClient() {
775775
776776 // update
777777 // \Grpc\ChannelCredentials::createSsl();
778- $ metadata = array (
779- 'authorization ' => 'Wechaty ' . ($ this ->_puppetOptions ? $ this ->_puppetOptions ->token : "" ),
778+ $ token = array (
779+ "token_type " => "Wechaty " ,
780+ "access_token " => $ this ->_puppetOptions ? $ this ->_puppetOptions ->token : "" ,
780781 );
781- Logger::DEBUG ($ metadata );
782+ $ updateMetadata =
783+ function ($ metadata ,
784+ $ authUri = null ,
785+ $ client = null ) use ($ token ) {
786+ $ metadataCopy = $ metadata ;
787+ $ metadataCopy ["authorization " ] =
788+ [sprintf ('%s %s ' ,
789+ $ token ['token_type ' ],
790+ $ token ['access_token ' ])];
791+
792+ return $ metadataCopy ;
793+ };
794+ Logger::DEBUG ($ updateMetadata );
782795 $ this ->_grpcClient = new \Wechaty \PuppetClient ($ hostname , [
783796 'credentials ' => \Grpc \ChannelCredentials::createInsecure (),
784- 'update_metadata ' => $ metadata ,
797+ 'update_metadata ' => $ updateMetadata ,
785798 ]);
786799 return $ this ->_grpcClient ;
787800 }
You can’t perform that action at this time.
0 commit comments