Developers · SDKs
Go SDK
The Go SDK lives in the repository's sdks/go folder (package authguard) and uses go-oidc/v3 with go-jose/v4. It is not published yet: point your go.mod at the local copy with a replace directive.
Install
go mod edit -require=<sdks/go module>@v0.1.0 -replace=<sdks/go module>=../authguard/sdks/goThe exact module name is in the go.mod of the sdks/go folder.
Create a request and wait
intents, err := authguard.NewIntentsClient(authguard.IntentsConfig{
BaseURL: "https://identity.example.com",
ClientID: os.Getenv("AUTHGUARD_CLIENT_ID"),
ClientSecret: os.Getenv("AUTHGUARD_CLIENT_SECRET"),
})
if err != nil {
return err
}
result, err := intents.CreateIntent(ctx, authguard.CreateIntentRequest{
OperationType: "invoice.pay",
SubjectEmail: "ana@example.com",
ExternalReference: "INV-42",
ExpiresInSeconds: 900,
Fields: map[string]any{
"amount": authguard.MoneyValue{Amount: "1250.00", Currency: "EUR"},
},
}, "erp-INV-42-attempt-1")
if err != nil {
return err
}
fmt.Println(result.Intent.ComparisonCode) // show it next to the operation
decided, err := intents.WaitForDecision(ctx, result.Intent.IntentID,
&authguard.WaitOptions{Timeout: 15 * time.Minute})Webhooks, receipts and OIDC
The package has functions to verify Standard Webhooks, the request digest and the receipt, and the OIDC flow with PKCE. Always use the raw body bytes and deduplicate on webhook-id.
Error codes in this article
Was this page helpful?
Thank you. Your answer stays in this browser; nothing is sent.
Sorry about that. Try:
- searching for the exact text of the message or the error code
- the error code index
- asking your organization's administrator