billions-minister-2901
09/26/2024, 7:56 PMbrief-egg-61061
09/26/2024, 7:56 PMbrief-egg-61061
09/26/2024, 7:56 PMhttps://{project-slug}.<http://projects.oryapis.com/|projects.oryapis.com/>
. The {project-slug}
part should be replaced with your specific project's slug. For example, if you have a project with the slug my-project
, the base URL for the administrative APIs would be <https://my-project.projects.oryapis.com/>
. Please note that to access the administrative APIs, you need a valid Personal Access Token. For more details, you can refer to the [Ory API Reference](https://www.ory.sh/docs/reference/api).billions-minister-2901
09/26/2024, 7:57 PMbrief-egg-61061
09/26/2024, 7:57 PMbrief-egg-61061
09/26/2024, 7:57 PMjavascript import { Configuration, IdentityApi } from "@ory/client" const identity = new IdentityApi( new Configuration({ basePath: "<https://ory.your-custom-domain.com>", baseOptions: { withCredentials: true, }, }), )
In this example, replace "<https://ory.your-custom-domain.com>"
with your project's specific base URL, which would be something like <https://my-project.projects.oryapis.com/>
. Please note that to use the Admin APIs, you need an Ory Network API Key. You can create API Keys in the Ory Console. For more details, you can refer to the [gRPC + REST API Overview](https://www.ory.sh/docs/api) and the [Getting Started Guide](https://www.ory.sh/docs/getting-started/local-development#ory-apis).billions-minister-2901
09/26/2024, 8:01 PMbrief-egg-61061
09/26/2024, 8:01 PMbrief-egg-61061
09/26/2024, 8:01 PMAuthorization
header of the API request. Here's an example of how you might include the API key when making a request to the /admin/identities
endpoint: http GET /admin/identities HTTP/1.1 Host: $<http://PROJECT_SLUG.projects.oryapis.com|PROJECT_SLUG.projects.oryapis.com> Accept: application/json Authorization: Bearer $API_KEY
In this example, replace $PROJECT_SLUG
with your project's slug and $API_KEY
with your API key. For more details, you can refer to the [Ory Network API Keys](https://www.ory.sh/docs/concepts/personal-access-token#authorizing-ory-network-project-admin-apis) documentation.billions-minister-2901
09/26/2024, 8:16 PMbrief-egg-61061
09/26/2024, 8:16 PMbrief-egg-61061
09/26/2024, 8:17 PM{URL-encoded-client-ID}:{URL-encoded-client-secret}
. Here's an example of how to make an authenticated request to the Ory Hydra Admin API using Basic Authentication in Go: go package main import ( "context" "encoding/base64" "fmt" "net/http" client "<http://github.com/ory/hydra-client-go|github.com/ory/hydra-client-go>" ) type BasicAuthTransport struct { Username string Password string } func (t BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error) { req.Header.Set("Authorization", fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", t.Username, t.Password))))) return http.DefaultTransport.RoundTrip(req) } func main() { config := client.NewConfiguration() config.Servers = []client.ServerConfiguration{ { URL: "<http://localhost:4445>", // Admin API }, } c := client.NewAPIClient(config) config.HTTPClient.Transport = BasicAuthTransport{Username: "foo", Password: "bar"} req := c.OAuth2Api.GetOAuth2ConsentRequest(context.Background()).ConsentChallenge("consentChallenge_example") fmt.Println(req.Execute()) }
In this example, replace "foo"
and "bar"
with your client ID and client secret, respectively. For more details, you can refer to the [Ory Hydra Go With Authentication](https://www.ory.sh/docs/hydra/self-hosted/go#with-authentication) documentation.