<@U04UQ68083H> What's the /admin URL for Ory Netwo...
# ory-copilot
b
@chilly-king-10285 What's the /admin URL for Ory Network?
b
A message from kapa.ai
The base URL for the Ory Network's administrative APIs is
https://{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).
b
@chilly-king-10285 TO find identities and such
b
A message from kapa.ai
To interact with identities in Ory, you would use the Identity API. This is part of the Admin APIs, which offer privileged access not available to end users. Here's an example of how you might set up the Identity API using the Ory SDK:
Copy code
javascript 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).
b
@chilly-king-10285 how do I pass the access key to /admin/identities as a query param?
b
A message from kapa.ai
The access key, or API key, is not passed as a query parameter but is included in the
Authorization
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:
Copy code
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.
b
@chilly-king-10285 Can we do basic authentication?
b
A message from kapa.ai
Yes, Ory supports Basic Authentication. In Basic Authentication, the client sends its client ID and client secret as part of the Authorization header in an HTTP request. The Authorization header contains a Base64-encoded string of
{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:
Copy code
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.