Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to provide an Authorization Token in Golang #671

Closed
ghost opened this issue Dec 14, 2021 · 4 comments
Closed

How to provide an Authorization Token in Golang #671

ghost opened this issue Dec 14, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Dec 14, 2021

the golang sdk doc dose not talk about any possible way how a user can provide authorization token, just like in java sdk theres a separate doc for authorization. can we have a similar doc, and i would like to know how it can be done.

https://docs.temporal.io/docs/content/how-to-provide-an-authorization-token-in-java

@ghost ghost added the enhancement New feature or request label Dec 14, 2021
@cretz
Copy link
Member

cretz commented Dec 14, 2021

I have opened temporalio/samples-go#160 to address this.

There are two ways, you can set client.Options.HeadersProvider with an instance that returns a map with Authorization as the key and Bearer <mytoken> as the value.

The other way is only on the newest SDK. You can set gRPC dial options directly on client.Options.ConnectionOptions.DialOptions which could have an interceptor where you can set the header via gRPC metadata. This is basically how the first way is implemented.

@cretz
Copy link
Member

cretz commented Jan 18, 2022

Sample PR merged

@cretz cretz closed this as completed Jan 18, 2022
@AbhayP-22
Copy link

Do we have the sample to add token in go lang SDK

@cretz
Copy link
Member

cretz commented May 6, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants