You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm get a panic when trying to list all projects using an Org API Key. This works with an environment scoped API Key.
package main
import (
"context""fmt""github.com/permitio/permit-golang/pkg/config""github.com/permitio/permit-golang/pkg/permit""go.uber.org/zap"
)
funcmain() {
// This line initializes the SDK and connects your Go app// to the Permit.io PDP container (you've set in the previous step), with the API key provided.permitClient:=permit.NewPermit(
// Building new config for Permit client
config.NewConfigBuilder(
// your api key "***").// Set the PDP URLWithLogger(zap.NewExample()).
WithPdpUrl("http://localhost:7766").
Build(),
)
ctx:=context.TODO()
projects, _:=permitClient.Api.Projects.List(ctx, 1, 10)
fori:=0; i<len(projects); i++ {
fmt.Println(projects[i].Name)
}
}
I was able to work through these panics, but then get this error
{"level":"error","msg":"","error":"ErrorCode: ContextError ErrorType:general_error Message:The context is missing or invalid - You're trying to use an SDK method that's specific to a project,but you haven't set the current project in your client's context yet,or you are using an organization level API key.Please set the context to a specificproject using `PermitClient.SetPermitContext()` method."}
The text was updated successfully, but these errors were encountered:
I'm get a panic when trying to list all projects using an Org API Key. This works with an environment scoped API Key.
However, I get this panic
I was able to work through these panics, but then get this error
The text was updated successfully, but these errors were encountered: