Hi,
I was using JavaSDK and moving to goSDK.
Java SDK
WorkflowServiceStubs service = WorkflowServiceStubs
.newInstance(WorkflowServiceStubsOptions
.newBuilder()
.setEnableHttps(true)
.addGrpcMetadataProvider(new AuthorizationGrpcMetadataProvider(() -> AUTH_TOKEN))
.setTarget(TEMPORAL_SERVER_TARGET_URL)
.build());
What would be equalent above code in goSdk api?
especially for AuthorizationGRpcMetaDataProvider passing the token.
Can you please share the piece of code?
For Go you can use something like:
c, err := client.NewClient(client.Options{
HeadersProvider: ...,
ConnectionOptions: ...,
HostPort: ...,
})
For setting auth token see if this sample helps.
Where should i pass the bearer token?
c, err := client.NewClient(client.Options{
HeadersProvider: &serverjwtauth.JWTHeadersProvider{
Config: serverjwtauth.JWTConfig{
Key: key,
KeyID: jwk.KeyID,
Permissions: string{
“default:read”,
“default:write”,
},
},
},
})
I believe you can write your own HeadersProvider interface and pass the token directly and set your headers that you might need. JWTHeadersProvider implementation in sample supports token refresh etc which you might not need as well.