Oci auth method from golang code

I am using the OCI auth method as described here and am looking for a programatic way (from golang code) to do the equivalent of vault login -method=oci auth_type=instance role=myrole.

My golang code looks something like this:
config := &api.Config{
Address: vaultAddr,
client, err := api.NewClient(config)
if err != nil {
c := client.Logical()
secret, err := c.Read(“secret/test”)

Suggestions for the best way to get the token using the OCI auth method?

Hi @eshneken,

It’s a large example, but this is the go code that actually powers the vault login -method=oci auth_type=instance role=myrole CLI command. You may be able to pull some useful snippets from it.

Hope this helps!

Thanks, that was definitely helpful. I poached some of the code from the cli.go and the oci_client.go to construct the request but the call to client.Logical().Write(…) returns a nil secret without any error. Any ideas on what could cause this or how to further debug?