limited-city-59768
02/13/2024, 9:49 AMchilly-king-10285
02/13/2024, 9:49 AMchilly-king-10285
02/13/2024, 9:49 AMhydra create client
or hydra create oauth2-client
command. Here is an example of how to do it: bash hydra create client -n "my app" -g client_credentials -r token -a core,foobar --keybase keybase_username
Or with the hydra create oauth2-client
command: bash hydra create oauth2-client -n "my app" -c <http://localhost/cb> -g authorization_code -r code -a core,foobar
After running the command, you can use a JSON tool like jq
to extract the client ID and secret from the output: bash client=$(hydra create client \ --endpoint ... \ --format json \ ...) echo $client # Parse the JSON response using jq to get the client ID and client secret: client_id=$(echo $client | jq -r '.client_id') client_secret=$(echo $client | jq -r '.client_secret')
Please note that the --endpoint
flag should be replaced with the actual endpoint of your Hydra server. Sources: - [Hydra create client](https://www.ory.sh/docs/hydra/cli/hydra-create-client#hydra-create-client) - [Hydra create oauth2-client](https://www.ory.sh/docs/hydra/cli/hydra-create-oauth2-client#hydra-create-oauth2-client)limited-city-59768
02/13/2024, 9:57 AMchilly-king-10285
02/13/2024, 9:57 AMchilly-king-10285
02/13/2024, 9:57 AM/.well-known/jwks.json
, /.well-known/openid-configuration
, /oauth2/auth
, /oauth2/token
, and more. This port can and should be exposed to public internet traffic. The administrative port handles requests to endpoints like /clients
, /keys
, /health
, /admin/metrics/prometheus
, /admin/version
, and more. This port should not be exposed to public internet traffic. If you want to expose certain endpoints, you need to properly secure these endpoints with an API Gateway or Authorization Proxy. The base URL for the Ory Hydra API is /
. Please note that the actual endpoint of your Hydra server will depend on where it is hosted. For example, if you are running Hydra locally, the endpoint might be <http://localhost:4444>
for the public port and <http://localhost:4445>
for the administrative port. Source: [Exposing administrative and public API endpoints](https://www.ory.sh/docs/hydra/self-hosted/production#exposing-administrative-and-public-api-endpoints)limited-city-59768
02/13/2024, 10:24 AMchilly-king-10285
02/13/2024, 10:25 AMchilly-king-10285
02/13/2024, 10:25 AMbash hydra create client -n "my app" -g client_credentials -r token -a core,foobar --keybase keybase_username
Or with the hydra create oauth2-client
command: bash hydra create oauth2-client -n "my app" -c <http://localhost/cb> -g authorization_code -r code -a core,foobar
After running the command, you can use a JSON tool like jq
to extract the client ID and secret from the output: bash client=$(hydra create client \ --endpoint ... \ --format json \ ...) echo $client # Parse the JSON response using jq to get the client ID and client secret: client_id=$(echo $client | jq -r '.client_id') client_secret=$(echo $client | jq -r '.client_secret')
Please note that the --endpoint
flag should be replaced with the actual endpoint of your Hydra server. Sources: - [Hydra create client](https://www.ory.sh/docs/hydra/cli/hydra-create-client#hydra-create-client) - [Hydra create oauth2-client](https://www.ory.sh/docs/hydra/cli/hydra-create-oauth2-client#hydra-create-oauth2-client)limited-city-59768
02/13/2024, 10:26 AMchilly-king-10285
02/13/2024, 10:26 AMchilly-king-10285
02/13/2024, 10:26 AMjavascript import { Configuration, OAuth2Api } from "@ory/client" const ory = new OAuth2Api( new Configuration({ basePath: `https://${process.env.ORY_PROJECT_SLUG}.<http://projects.oryapis.com|projects.oryapis.com>`, accessToken: process.env.ORY_API_KEY, }), ) export async function createOAuth2Client() { await ory.createOAuth2Client({ oAuth2Client: { grant_types: ["authorization_code", "refresh_token"], redirect_uris: ["<https://example.com>"], scope: "offline openid", token_endpoint_auth_method: "client_secret_post", }, }) }
In the Ory Console, you can create a new client by signing in to the Ory Console, selecting OAuth2 Clients, clicking Add New Client, and completing the form or updating an existing client. Please note that you need to replace the placeholders in the code with your actual values. Sources: - [Create OAuth2 client](https://www.ory.sh/docs/hydra/guides/oauth2-clients#create-oauth2-client) - [API documentation](https://www.ory.sh/docs/reference/api#tag/oAuth2/operation/createOAuth2Client)stocky-traffic-51600
04/12/2024, 1:13 PMchilly-king-10285
04/12/2024, 1:13 PMchilly-king-10285
04/12/2024, 1:14 PMgetProjectMetrics
API endpoint. The endpoint is GET /projects/{project_id}/metrics
and it retrieves project metrics for the specified event type and time range. Here are the parameters you need to provide: - project_id
(in URL, required): The ID of the project. - event_type
(query parameter, required): The event type to query for. - resolution
(query parameter, required): The resolution of the buckets. The minimum resolution is 1 minute. - from
(query parameter, required): The start RFC3339 date of the time window. - to
(query parameter, required): The end RFC3339 date of the time window. The response will be a list of data points, each representing a single datapoint/bucket of a time series. Each data point will have a count
(the count of events that occurred in this time) and time
(the time of the bucket). Please note that to perform this operation, you must be authenticated by means of one of the following methods: oryAccessToken
. Here is an example of how to use this endpoint: bash curl -X GET "<https://your-ory-instance.com/projects/{project_id}/metrics?event_type={event_type}&resolution={resolution}&from={from}&to={to}>" -H "Authorization: Bearer {oryAccessToken}"
Please replace {project_id}
, {event_type}
, {resolution}
, {from}
, {to}
, and {oryAccessToken}
with your actual values. Source: [Ory API Reference](https://www.ory.sh/docs/reference/api)