Get google's access token from google cloud

100 views
Skip to first unread message

Manh Tran

unread,
Aug 24, 2016, 10:03:06 PM8/24/16
to grpc.io
Hi,

I'm writing a gRPC client connect to google cloud speech. I think it needs an access token to connect to google cloud. Please tell me how to get an access token OAuth2 on gRPC C++.

Thanks.

Yang Gao

unread,
Aug 25, 2016, 2:44:53 AM8/25/16
to Manh Tran, grpc.io
Try creating the channel with GoogleDefaultCredentials(). See http://www.grpc.io/docs/guides/auth.html#using-google-token-based-authentication for more details.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/b5d211f5-c03a-405f-ac1c-13b270bf8a02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Manh Tran

unread,
Aug 26, 2016, 5:25:00 AM8/26/16
to grpc.io, manht...@gmail.com
Dear Yang,

I've created the channel with GoogleDefaultCredentials() as the following code and streaming audio to google cloud speech. But google cloud not response.

..
using google::cloud::speech::v1beta1::Speech;

class GoogleClient {
 public:
GoogleClient(std::shared_ptr<Channel> channel)
      : stub_(Speech::NewStub(channel)) {}
 private:
  std::unique_ptr<Speech::Stub> stub_;
};

int main(int argc, char** argv) {

auto channel_creds = grpc::GoogleDefaultCredentials();
auto channel = grpc::CreateChannel("speech.googleapis.com:443", channel_creds);
GoogleClient ggclient(channel);
..
}

Please check it for me.
Thanks.

On Thursday, August 25, 2016 at 1:44:53 PM UTC+7, Yang Gao wrote:
Try creating the channel with GoogleDefaultCredentials(). See http://www.grpc.io/docs/guides/auth.html#using-google-token-based-authentication for more details.
On Wed, Aug 24, 2016 at 7:03 PM, Manh Tran <manht...@gmail.com> wrote:
Hi,

I'm writing a gRPC client connect to google cloud speech. I think it needs an access token to connect to google cloud. Please tell me how to get an access token OAuth2 on gRPC C++.

Thanks.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.

Евгений Абрамов

unread,
Sep 29, 2016, 5:07:26 AM9/29/16
to grpc.io, manht...@gmail.com
Hello,
Try remove port number from url "speech.googleapis.com:443" =>"speech.googleapis.com".



Reply all
Reply to author
Forward
0 new messages