<@U04UQ68083H> How to get verification flow id in ...
# ory-copilot
w
@chilly-king-10285 How to get verification flow id in with Go SDK?
is.publicClient.FrontendApi.CreateBrowserRegistrationFlow(ctx).Execute()
c
A message from kapa.ai
To get the verification flow ID with the Go SDK, you can use the
GetVerification
function. This function takes a context and a flow ID as parameters and returns a
VerificationFlow
object and an error. Here is an example of how you can use it:
Copy code
go package frontend      import (    "context"    "fmt"    "os"       "<http://github.com/ory/client-go|github.com/ory/client-go>"   )      type oryMiddleware struct {    ory *ory.APIClient   }      func init() {    cfg := client.NewConfiguration()    cfg.Servers = client.ServerConfigurations{    {URL: fmt.Sprintf("<https://%s.projects.oryapis.com>", os.Getenv("ORY_PROJECT_SLUG"))},    }       ory = client.NewAPIClient(cfg)   }      func GetVerification(ctx context.Context, flowId string) (*client.VerificationFlow, error) {    flow, _, err := ory.FrontendApi.GetVerificationFlow(ctx).Id(flowId).Execute()    if err != nil {    return nil, err    }       return flow, nil   }
In this code,
GetVerification
is a function that takes a context and a flow ID as parameters. It uses the
GetVerificationFlow
method of the
FrontendApi
to get the verification flow with the specified ID. If there is an error, it returns
nil
and the error. Otherwise, it returns the verification flow and
nil
for the error. Please note that the flow ID is usually stored in the
?flow=
URL query parameter in your application. You can retrieve it by sending a GET request that contains the flow ID to the
/self-service/verification/flows?id=<flow-id>
endpoint. Sources: - [Ory Documentation](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration) - [Ory API Reference](https://www.ory.sh/docs/reference/api)