# Equalent api in temporal go sdk

**URL:** <https://community.temporal.io/t/equalent-api-in-temporal-go-sdk/4650>\
**Category:** Community Support\
**Tags:** go-sdk\
**Created:** [May 9, 2022, 1:14pm UTC](https://community.temporal.io/t/equalent-api-in-temporal-go-sdk/4650 "2022-05-09T13:14:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaffarsadik](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/jaffarsadik/32/991_2.png) [@jaffarsadik](https://community.temporal.io/u/jaffarsadik)\
**Post date:** [May 9, 2022, 1:14pm UTC](https://community.temporal.io/t/equalent-api-in-temporal-go-sdk/4650/1 "2022-05-09T13:14:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [May 9, 2022, 3:42pm UTC](https://community.temporal.io/t/equalent-api-in-temporal-go-sdk/4650/2 "2022-05-09T15:42:33Z")

</div>

For Go you can use something like:

```auto
	c, err := client.NewClient(client.Options{
		HeadersProvider: ...,
		ConnectionOptions: ...,
		HostPort: ...,
	})

```

For setting auth token see if [this](https://github.com/temporalio/samples-go/tree/main/serverjwtauth) sample helps.

---

<div class="post-metadata">

**Author:** ![jaffarsadik](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/jaffarsadik/32/991_2.png) [@jaffarsadik](https://community.temporal.io/u/jaffarsadik)\
**Post date:** [May 12, 2022, 2:45pm UTC](https://community.temporal.io/t/equalent-api-in-temporal-go-sdk/4650/3 "2022-05-12T14:45:19Z")

</div>

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”,  
> },  
> },  
> },  
> })

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [May 12, 2022, 9:11pm UTC](https://community.temporal.io/t/equalent-api-in-temporal-go-sdk/4650/4 "2022-05-12T21:11:55Z")

</div>

I believe you can write your own [HeadersProvider](https://github.com/temporalio/samples-go/blob/main/serverjwtauth/keyutil.go#L146) 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.
