File tree 1 file changed +17
-4
lines changed
wechaty-puppet-hostie/IO/Github/Wechaty/PuppetHostie
1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -775,13 +775,26 @@ private function _startGrpcClient() {
775
775
776
776
// update
777
777
// \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 : "" ,
780
781
);
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 );
782
795
$ this ->_grpcClient = new \Wechaty \PuppetClient ($ hostname , [
783
796
'credentials ' => \Grpc \ChannelCredentials::createInsecure (),
784
- 'update_metadata ' => $ metadata ,
797
+ 'update_metadata ' => $ updateMetadata ,
785
798
]);
786
799
return $ this ->_grpcClient ;
787
800
}
You can’t perform that action at this time.
0 commit comments