Project: ORY Hydra (Provisioning / Key Management)
File: OAuth2Api.md

All URIs are relative to http://localhost Method | HTTP request | Description | - | - | Put /admin/oauth2/auth/requests/consent/accept | Accept OAuth 2.0 Consent Request | Put /admin/oauth2/auth/requests/login/accept | Accept OAuth 2.0 Login Request | Put /admin/oauth2/auth/requests/logout/accept | Accept OAuth 2.0 Session Logout Request | Post /admin/clients | Create OAuth 2.0 Client | Delete /admin/clients/{id} | Delete OAuth 2.0 Client | Delete /admin/oauth2/tokens | Delete OAuth 2.0 Access Tokens from specific OAuth 2.0 Client | Delete /admin/trust/grants/jwt-bearer/issuers/{id} | Delete Trusted OAuth2 JWT Bearer Grant Type Issuer | Get /admin/clients/{id} | Get an OAuth 2.0 Client | Get /admin/oauth2/auth/requests/consent | Get OAuth 2.0 Consent Request | Get /admin/oauth2/auth/requests/login | Get OAuth 2.0 Login Request | Get /admin/oauth2/auth/requests/logout | Get OAuth 2.0 Session Logout Request | Get /admin/trust/grants/jwt-bearer/issuers/{id} | Get Trusted OAuth2 JWT Bearer Grant Type Issuer | Post /admin/oauth2/introspect | Introspect OAuth2 Access and Refresh Tokens | Get /admin/clients | List OAuth 2.0 Clients | Get /admin/oauth2/auth/sessions/consent | List OAuth 2.0 Consent Sessions of a Subject | Get /admin/trust/grants/jwt-bearer/issuers | List Trusted OAuth2 JWT Bearer Grant Type Issuers | Get /oauth2/auth | OAuth 2.0 Authorize Endpoint | Post /oauth2/token | The OAuth 2.0 Token Endpoint | Patch /admin/clients/{id} | Patch OAuth 2.0 Client | Put /admin/oauth2/auth/requests/consent/reject | Reject OAuth 2.0 Consent Request | Put /admin/oauth2/auth/requests/login/reject | Reject OAuth 2.0 Login Request | Put /admin/oauth2/auth/requests/logout/reject | Reject OAuth 2.0 Session Logout Request | Delete /admin/oauth2/auth/sessions/consent | Revoke OAuth 2.0 Consent Sessions of a Subject | Delete /admin/oauth2/auth/sessions/login | Revokes OAuth 2.0 Login Sessions by either a Subject or a SessionID | Post /oauth2/revoke | Revoke OAuth 2.0 Access or Refresh Token | Put /admin/clients/{id} | Set OAuth 2.0 Client | Put /admin/clients/{id}/lifespans | Set OAuth2 Client Token Lifespans | Post /admin/trust/grants/jwt-bearer/issuers | Trust OAuth2 JWT Bearer Grant Type Issuer OAuth2RedirectTo AcceptOAuth2ConsentRequest(ctx).ConsentChallenge(consentChallenge).AcceptOAuth2ConsentRequest(acceptOAuth2ConsentRequest).Execute() Accept OAuth 2.0 Consent Request ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { consentChallenge := "consentChallenge_example" // string | OAuth 2.0 Consent Request Challenge acceptOAuth2ConsentRequest := *openapiclient.NewAcceptOAuth2ConsentRequest() // AcceptOAuth2ConsentRequest | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.AcceptOAuth2ConsentRequest(context.Background()).ConsentChallenge(consentChallenge).AcceptOAuth2ConsentRequest(acceptOAuth2ConsentRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.AcceptOAuth2ConsentRequest``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `AcceptOAuth2ConsentRequest`: OAuth2RedirectTo fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.AcceptOAuth2ConsentRequest`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiAcceptOAuth2ConsentRequestRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - consentChallenge | string | OAuth 2.0 Consent Request Challenge | acceptOAuth2ConsentRequest | | | No authorization required Content-Type: application/json Accept: application/json OAuth2RedirectTo AcceptOAuth2LoginRequest(ctx).LoginChallenge(loginChallenge).AcceptOAuth2LoginRequest(acceptOAuth2LoginRequest).Execute() Accept OAuth 2.0 Login Request ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { loginChallenge := "loginChallenge_example" // string | OAuth 2.0 Login Request Challenge acceptOAuth2LoginRequest := *openapiclient.NewAcceptOAuth2LoginRequest("Subject_example") // AcceptOAuth2LoginRequest | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.AcceptOAuth2LoginRequest(context.Background()).LoginChallenge(loginChallenge).AcceptOAuth2LoginRequest(acceptOAuth2LoginRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.AcceptOAuth2LoginRequest``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `AcceptOAuth2LoginRequest`: OAuth2RedirectTo fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.AcceptOAuth2LoginRequest`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiAcceptOAuth2LoginRequestRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - loginChallenge | string | OAuth 2.0 Login Request Challenge | acceptOAuth2LoginRequest | | | No authorization required Content-Type: application/json Accept: application/json OAuth2RedirectTo AcceptOAuth2LogoutRequest(ctx).LogoutChallenge(logoutChallenge).Execute() Accept OAuth

Session Logout Request ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { logoutChallenge := "logoutChallenge_example" // string | OAuth 2.0 Logout Request Challenge configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.AcceptOAuth2LogoutRequest(context.Background()).LogoutChallenge(logoutChallenge).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.AcceptOAuth2LogoutRequest``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `AcceptOAuth2LogoutRequest`: OAuth2RedirectTo fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.AcceptOAuth2LogoutRequest`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiAcceptOAuth2LogoutRequestRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - logoutChallenge | string | OAuth 2.0 Logout Request Challenge | No authorization required Content-Type: Not defined Accept: application/json OAuth2Client CreateOAuth2Client(ctx).OAuth2Client(oAuth2Client).Execute() Create OAuth 2.0 Client ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { oAuth2Client := *openapiclient.NewOAuth2Client() // OAuth2Client | OAuth 2.0 Client Request Body configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.CreateOAuth2Client(context.Background()).OAuth2Client(oAuth2Client).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.CreateOAuth2Client``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `CreateOAuth2Client`: OAuth2Client fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.CreateOAuth2Client`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiCreateOAuth2ClientRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - oAuth2Client | | OAuth 2.0 Client Request Body | No authorization required Content-Type: application/json Accept: application/json DeleteOAuth2Client(ctx, id).Execute() Delete OAuth 2.0 Client ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { id := "id_example" // string | The id of the OAuth 2.0 Client. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) r, err := apiClient.OAuth2Api.DeleteOAuth2Client(context.Background(), id).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.DeleteOAuth2Client``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } } ``` Name | Type | Description | Notes | - | - | - ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. id | string | The id of the OAuth 2.0 Client. | Other parameters are passed through a pointer to a apiDeleteOAuth2ClientRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - (empty response body) No authorization required Content-Type: Not defined Accept: application/json DeleteOAuth2Token(ctx).ClientId(clientId).Execute() Delete OAuth 2.0 Access Tokens from specific OAuth 2.0 Client ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { clientId := "clientId_example" // string | OAuth 2.0 Client ID configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) r, err := apiClient.OAuth2Api.DeleteOAuth2Token(context.Background()).ClientId(clientId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.DeleteOAuth2Token``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } } ``` Other parameters are passed through a pointer to a apiDeleteOAuth2TokenRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - clientId | string | OAuth 2.0 Client ID | (empty response body) No authorization required Content-Type: Not defined Accept: application/json DeleteTrustedOAuth2JwtGrantIssuer(ctx, id).Execute() Delete Trusted OAuth2 JWT Bearer Grant Type Issuer ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { id := "id_example" // string | The id of the desired grant configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) r, err := apiClient.OAuth2Api.DeleteTrustedOAuth2JwtGrantIssuer(context.Background(), id).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.DeleteTrustedOAuth2JwtGrantIssuer``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } } ``` Name | Type | Description | Notes | - | - | - ctx |

| context for authentication, logging, cancellation, deadlines, tracing, etc. id | string | The id of the desired grant | Other parameters are passed through a pointer to a apiDeleteTrustedOAuth2JwtGrantIssuerRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - (empty response body) No authorization required Content-Type: Not defined Accept: application/json OAuth2Client GetOAuth2Client(ctx, id).Execute() Get an OAuth 2.0 Client ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { id := "id_example" // string | The id of the OAuth 2.0 Client. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.GetOAuth2Client(context.Background(), id).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.GetOAuth2Client``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOAuth2Client`: OAuth2Client fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.GetOAuth2Client`: %v\n", resp) } ``` Name | Type | Description | Notes | - | - | - ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. id | string | The id of the OAuth 2.0 Client. | Other parameters are passed through a pointer to a apiGetOAuth2ClientRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - No authorization required Content-Type: Not defined Accept: application/json OAuth2ConsentRequest GetOAuth2ConsentRequest(ctx).ConsentChallenge(consentChallenge).Execute() Get OAuth 2.0 Consent Request ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { consentChallenge := "consentChallenge_example" // string | OAuth 2.0 Consent Request Challenge configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.GetOAuth2ConsentRequest(context.Background()).ConsentChallenge(consentChallenge).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.GetOAuth2ConsentRequest``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOAuth2ConsentRequest`: OAuth2ConsentRequest fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.GetOAuth2ConsentRequest`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiGetOAuth2ConsentRequestRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - consentChallenge | string | OAuth 2.0 Consent Request Challenge | No authorization required Content-Type: Not defined Accept: application/json OAuth2LoginRequest GetOAuth2LoginRequest(ctx).LoginChallenge(loginChallenge).Execute() Get OAuth 2.0 Login Request ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { loginChallenge := "loginChallenge_example" // string | OAuth 2.0 Login Request Challenge configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.GetOAuth2LoginRequest(context.Background()).LoginChallenge(loginChallenge).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.GetOAuth2LoginRequest``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOAuth2LoginRequest`: OAuth2LoginRequest fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.GetOAuth2LoginRequest`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiGetOAuth2LoginRequestRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - loginChallenge | string | OAuth 2.0 Login Request Challenge | No authorization required Content-Type: Not defined Accept: application/json OAuth2LogoutRequest GetOAuth2LogoutRequest(ctx).LogoutChallenge(logoutChallenge).Execute() Get OAuth 2.0 Session Logout Request ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { logoutChallenge := "logoutChallenge_example" // string | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.GetOAuth2LogoutRequest(context.Background()).LogoutChallenge(logoutChallenge).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.GetOAuth2LogoutRequest``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOAuth2LogoutRequest`: OAuth2LogoutRequest fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.GetOAuth2LogoutRequest`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiGetOAuth2LogoutRequestRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - logoutChallenge | string | | No authorization required Content-Type: Not defined Accept: application/json TrustedOAuth2JwtGrantIssuer GetTrustedOAuth2JwtGrantIssuer(ctx,

Get Trusted OAuth2 JWT Bearer Grant Type Issuer ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { id := "id_example" // string | The id of the desired grant configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.GetTrustedOAuth2JwtGrantIssuer(context.Background(), id).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.GetTrustedOAuth2JwtGrantIssuer``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetTrustedOAuth2JwtGrantIssuer`: TrustedOAuth2JwtGrantIssuer fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.GetTrustedOAuth2JwtGrantIssuer`: %v\n", resp) } ``` Name | Type | Description | Notes | - | - | - ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. id | string | The id of the desired grant | Other parameters are passed through a pointer to a apiGetTrustedOAuth2JwtGrantIssuerRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - No authorization required Content-Type: Not defined Accept: application/json IntrospectedOAuth2Token IntrospectOAuth2Token(ctx).Token(token).Scope(scope).Execute() Introspect OAuth2 Access and Refresh Tokens ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { token := "tokenexample" // string | The string value of the token. For access tokens, this is the \\\"accesstoken\\\" value returned from the token endpoint defined in OAuth 2.0. For refresh tokens, this is the \\\"refresh_token\\\" value returned. scope := "scope_example" // string | An optional, space separated list of required scopes. If the access token was not granted one of the scopes, the result of active will be false. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.IntrospectOAuth2Token(context.Background()).Token(token).Scope(scope).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.IntrospectOAuth2Token``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `IntrospectOAuth2Token`: IntrospectedOAuth2Token fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.IntrospectOAuth2Token`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiIntrospectOAuth2TokenRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - token | string | The string value of the token. For access tokens, this is the \\\&quot;accesstoken\\\&quot; value returned from the token endpoint defined in OAuth 2.0. For refresh tokens, this is the \\\&quot;refreshtoken\\\&quot; value returned. | scope | string | An optional, space separated list of required scopes. If the access token was not granted one of the scopes, the result of active will be false. | No authorization required Content-Type: application/x-www-form-urlencoded Accept: application/json []OAuth2Client ListOAuth2Clients(ctx).PageSize(pageSize).PageToken(pageToken).ClientName(clientName).Owner(owner).Execute() List OAuth 2.0 Clients ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { pageSize := int64(789) // int64 | Items per Page This is the number of items per page to return. For details on pagination please head over to the . (optional) (default to 250) pageToken := "pageToken_example" // string | Next Page Token The next page token. For details on pagination please head over to the . (optional) (default to "1") clientName := "clientName_example" // string | The name of the clients to filter by. (optional) owner := "owner_example" // string | The owner of the clients to filter by. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.ListOAuth2Clients(context.Background()).PageSize(pageSize).PageToken(pageToken).ClientName(clientName).Owner(owner).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.ListOAuth2Clients``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListOAuth2Clients`: []OAuth2Client fmt.Fprintf(os.Stdout, "Response from

%v\n", resp) } ``` Other parameters are passed through a pointer to a apiListOAuth2ClientsRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - pageSize | int64 | Items per Page This is the number of items per page to return. For details on pagination please head over to the . | [default to 250] pageToken | string | Next Page Token The next page token. For details on pagination please head over to the . | [default to &quot;1&quot;] clientName | string | The name of the clients to filter by. | owner | string | The owner of the clients to filter by. | No authorization required Content-Type: Not defined Accept: application/json []OAuth2ConsentSession ListOAuth2ConsentSessions(ctx).Subject(subject).PageSize(pageSize).PageToken(pageToken).LoginSessionId(loginSessionId).Execute() List OAuth 2.0 Consent Sessions of a Subject ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { subject := "subject_example" // string | The subject to list the consent sessions for. pageSize := int64(789) // int64 | Items per Page This is the number of items per page to return. For details on pagination please head over to the . (optional) (default to 250) pageToken := "pageToken_example" // string | Next Page Token The next page token. For details on pagination please head over to the . (optional) (default to "1") loginSessionId := "loginSessionId_example" // string | The login session id to list the consent sessions for. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.ListOAuth2ConsentSessions(context.Background()).Subject(subject).PageSize(pageSize).PageToken(pageToken).LoginSessionId(loginSessionId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.ListOAuth2ConsentSessions``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListOAuth2ConsentSessions`: []OAuth2ConsentSession fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.ListOAuth2ConsentSessions`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiListOAuth2ConsentSessionsRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - subject | string | The subject to list the consent sessions for. | pageSize | int64 | Items per Page This is the number of items per page to return. For details on pagination please head over to the . | [default to 250] pageToken | string | Next Page Token The next page token. For details on pagination please head over to the . | [default to &quot;1&quot;] loginSessionId | string | The login session id to list the consent sessions for. | No authorization required Content-Type: Not defined Accept: application/json []TrustedOAuth2JwtGrantIssuer ListTrustedOAuth2JwtGrantIssuers(ctx).MaxItems(maxItems).DefaultItems(defaultItems).Issuer(issuer).Execute() List Trusted OAuth2 JWT Bearer Grant Type Issuers ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { maxItems := int64(789) // int64 | (optional) defaultItems := int64(789) // int64 | (optional) issuer := "issuer_example" // string | If optional \"issuer\" is supplied, only jwt-bearer grants with this issuer will be returned. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.ListTrustedOAuth2JwtGrantIssuers(context.Background()).MaxItems(maxItems).DefaultItems(defaultItems).Issuer(issuer).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.ListTrustedOAuth2JwtGrantIssuers``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListTrustedOAuth2JwtGrantIssuers`: []TrustedOAuth2JwtGrantIssuer fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.ListTrustedOAuth2JwtGrantIssuers`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiListTrustedOAuth2JwtGrantIssuersRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - maxItems | int64 | | defaultItems | int64 | | issuer | string | If optional \&quot;issuer\&quot; is supplied, only jwt-bearer grants with this issuer will be returned. | No authorization required Content-Type: Not defined Accept: application/json ErrorOAuth2 OAuth2Authorize(ctx).Execute() OAuth 2.0 Authorize Endpoint ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err :=

if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.OAuth2Authorize``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `OAuth2Authorize`: ErrorOAuth2 fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.OAuth2Authorize`: %v\n", resp) } ``` This endpoint does not need any parameter. Other parameters are passed through a pointer to a apiOAuth2AuthorizeRequest struct via the builder pattern No authorization required Content-Type: Not defined Accept: application/json OAuth2TokenExchange Oauth2TokenExchange(ctx).GrantType(grantType).ClientId(clientId).Code(code).RedirectUri(redirectUri).RefreshToken(refreshToken).Execute() The OAuth 2.0 Token Endpoint ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { grantType := "grantType_example" // string | clientId := "clientId_example" // string | (optional) code := "code_example" // string | (optional) redirectUri := "redirectUri_example" // string | (optional) refreshToken := "refreshToken_example" // string | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.Oauth2TokenExchange(context.Background()).GrantType(grantType).ClientId(clientId).Code(code).RedirectUri(redirectUri).RefreshToken(refreshToken).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.Oauth2TokenExchange``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `Oauth2TokenExchange`: OAuth2TokenExchange fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.Oauth2TokenExchange`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiOauth2TokenExchangeRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - grantType | string | | clientId | string | | code | string | | redirectUri | string | | refreshToken | string | | , Content-Type: application/x-www-form-urlencoded Accept: application/json OAuth2Client PatchOAuth2Client(ctx, id).JsonPatch(jsonPatch).Execute() Patch OAuth 2.0 Client ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { id := "id_example" // string | The id of the OAuth 2.0 Client. jsonPatch := []openapiclient.JsonPatch{*openapiclient.NewJsonPatch("replace", "/name")} // []JsonPatch | OAuth 2.0 Client JSON Patch Body configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.PatchOAuth2Client(context.Background(), id).JsonPatch(jsonPatch).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.PatchOAuth2Client``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `PatchOAuth2Client`: OAuth2Client fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.PatchOAuth2Client`: %v\n", resp) } ``` Name | Type | Description | Notes | - | - | - ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. id | string | The id of the OAuth 2.0 Client. | Other parameters are passed through a pointer to a apiPatchOAuth2ClientRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - jsonPatch | | OAuth 2.0 Client JSON Patch Body | No authorization required Content-Type: application/json Accept: application/json OAuth2RedirectTo RejectOAuth2ConsentRequest(ctx).ConsentChallenge(consentChallenge).RejectOAuth2Request(rejectOAuth2Request).Execute() Reject OAuth 2.0 Consent Request ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { consentChallenge := "consentChallenge_example" // string | OAuth 2.0 Consent Request Challenge rejectOAuth2Request := *openapiclient.NewRejectOAuth2Request() // RejectOAuth2Request | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.RejectOAuth2ConsentRequest(context.Background()).ConsentChallenge(consentChallenge).RejectOAuth2Request(rejectOAuth2Request).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.RejectOAuth2ConsentRequest``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `RejectOAuth2ConsentRequest`: OAuth2RedirectTo fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.RejectOAuth2ConsentRequest`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiRejectOAuth2ConsentRequestRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - consentChallenge | string | OAuth 2.0 Consent Request Challenge | rejectOAuth2Request | | | No authorization required Content-Type: application/json Accept: application/json OAuth2RedirectTo RejectOAuth2LoginRequest(ctx).LoginChallenge(loginChallenge).RejectOAuth2Request(rejectOAuth2Request).Execute() Reject OAuth 2.0 Login Request ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { loginChallenge := "loginChallenge_example" // string | OAuth 2.0 Login Request Challenge rejectOAuth2Request := *openapiclient.NewRejectOAuth2Request() // RejectOAuth2Request | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err :=

if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.RejectOAuth2LoginRequest``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `RejectOAuth2LoginRequest`: OAuth2RedirectTo fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.RejectOAuth2LoginRequest`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiRejectOAuth2LoginRequestRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - loginChallenge | string | OAuth 2.0 Login Request Challenge | rejectOAuth2Request | | | No authorization required Content-Type: application/json Accept: application/json RejectOAuth2LogoutRequest(ctx).LogoutChallenge(logoutChallenge).Execute() Reject OAuth 2.0 Session Logout Request ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { logoutChallenge := "logoutChallenge_example" // string | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) r, err := apiClient.OAuth2Api.RejectOAuth2LogoutRequest(context.Background()).LogoutChallenge(logoutChallenge).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.RejectOAuth2LogoutRequest``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } } ``` Other parameters are passed through a pointer to a apiRejectOAuth2LogoutRequestRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - logoutChallenge | string | | (empty response body) No authorization required Content-Type: Not defined Accept: application/json RevokeOAuth2ConsentSessions(ctx).Subject(subject).Client(client).All(all).Execute() Revoke OAuth 2.0 Consent Sessions of a Subject ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { subject := "subject_example" // string | OAuth 2.0 Consent Subject The subject whose consent sessions should be deleted. client := "client_example" // string | OAuth 2.0 Client ID If set, deletes only those consent sessions that have been granted to the specified OAuth 2.0 Client ID. (optional) all := true // bool | Revoke All Consent Sessions If set to `true` deletes all consent sessions by the Subject that have been granted. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) r, err := apiClient.OAuth2Api.RevokeOAuth2ConsentSessions(context.Background()).Subject(subject).Client(client).All(all).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.RevokeOAuth2ConsentSessions``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } } ``` Other parameters are passed through a pointer to a apiRevokeOAuth2ConsentSessionsRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - subject | string | OAuth 2.0 Consent Subject The subject whose consent sessions should be deleted. | client | string | OAuth 2.0 Client ID If set, deletes only those consent sessions that have been granted to the specified OAuth 2.0 Client ID. | all | bool | Revoke All Consent Sessions If set to &#x60;true&#x60; deletes all consent sessions by the Subject that have been granted. | (empty response body) No authorization required Content-Type: Not defined Accept: application/json RevokeOAuth2LoginSessions(ctx).Subject(subject).Sid(sid).Execute() Revokes OAuth 2.0 Login Sessions by either a Subject or a SessionID ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { subject := "subject_example" // string | OAuth 2.0 Subject The subject to revoke authentication sessions for. (optional) sid := "sid_example" // string | OAuth 2.0 Subject The subject to revoke authentication sessions for. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) r, err := apiClient.OAuth2Api.RevokeOAuth2LoginSessions(context.Background()).Subject(subject).Sid(sid).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.RevokeOAuth2LoginSessions``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } } ``` Other parameters are passed through a pointer to a apiRevokeOAuth2LoginSessionsRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - subject | string | OAuth 2.0 Subject The subject to revoke authentication sessions for. | sid | string | OAuth 2.0 Subject The subject to revoke authentication sessions

| (empty response body) No authorization required Content-Type: Not defined Accept: application/json RevokeOAuth2Token(ctx).Token(token).ClientId(clientId).ClientSecret(clientSecret).Execute() Revoke OAuth 2.0 Access or Refresh Token ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { token := "token_example" // string | clientId := "clientId_example" // string | (optional) clientSecret := "clientSecret_example" // string | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) r, err := apiClient.OAuth2Api.RevokeOAuth2Token(context.Background()).Token(token).ClientId(clientId).ClientSecret(clientSecret).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.RevokeOAuth2Token``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } } ``` Other parameters are passed through a pointer to a apiRevokeOAuth2TokenRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - token | string | | clientId | string | | clientSecret | string | | (empty response body) , Content-Type: application/x-www-form-urlencoded Accept: application/json OAuth2Client SetOAuth2Client(ctx, id).OAuth2Client(oAuth2Client).Execute() Set OAuth 2.0 Client ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { id := "id_example" // string | OAuth 2.0 Client ID oAuth2Client := *openapiclient.NewOAuth2Client() // OAuth2Client | OAuth 2.0 Client Request Body configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.SetOAuth2Client(context.Background(), id).OAuth2Client(oAuth2Client).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.SetOAuth2Client``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `SetOAuth2Client`: OAuth2Client fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.SetOAuth2Client`: %v\n", resp) } ``` Name | Type | Description | Notes | - | - | - ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. id | string | OAuth 2.0 Client ID | Other parameters are passed through a pointer to a apiSetOAuth2ClientRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - oAuth2Client | | OAuth 2.0 Client Request Body | No authorization required Content-Type: application/json Accept: application/json OAuth2Client SetOAuth2ClientLifespans(ctx, id).OAuth2ClientTokenLifespans(oAuth2ClientTokenLifespans).Execute() Set OAuth2 Client Token Lifespans ```go package main import ( "context" "fmt" "os" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { id := "id_example" // string | OAuth 2.0 Client ID oAuth2ClientTokenLifespans := *openapiclient.NewOAuth2ClientTokenLifespans() // OAuth2ClientTokenLifespans | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.SetOAuth2ClientLifespans(context.Background(), id).OAuth2ClientTokenLifespans(oAuth2ClientTokenLifespans).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.SetOAuth2ClientLifespans``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `SetOAuth2ClientLifespans`: OAuth2Client fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.SetOAuth2ClientLifespans`: %v\n", resp) } ``` Name | Type | Description | Notes | - | - | - ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. id | string | OAuth 2.0 Client ID | Other parameters are passed through a pointer to a apiSetOAuth2ClientLifespansRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - oAuth2ClientTokenLifespans | | | No authorization required Content-Type: application/json Accept: application/json TrustedOAuth2JwtGrantIssuer TrustOAuth2JwtGrantIssuer(ctx).TrustOAuth2JwtGrantIssuer(trustOAuth2JwtGrantIssuer).Execute() Trust OAuth2 JWT Bearer Grant Type Issuer ```go package main import ( "context" "fmt" "os" "time" openapiclient "github.com/ory/hydra-client-go/v2" ) func main() { trustOAuth2JwtGrantIssuer := openapiclient.NewTrustOAuth2JwtGrantIssuer(time.Now(), "https://jwt-idp.example.com", openapiclient.NewJsonWebKey("RS256", "1603dfe0af8f4596", "RSA", "sig"), []string{"Scope_example"}) // TrustOAuth2JwtGrantIssuer | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OAuth2Api.TrustOAuth2JwtGrantIssuer(context.Background()).TrustOAuth2JwtGrantIssuer(trustOAuth2JwtGrantIssuer).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.TrustOAuth2JwtGrantIssuer``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `TrustOAuth2JwtGrantIssuer`: TrustedOAuth2JwtGrantIssuer fmt.Fprintf(os.Stdout, "Response from `OAuth2Api.TrustOAuth2JwtGrantIssuer`: %v\n", resp) } ``` Other parameters are passed through a pointer to a apiTrustOAuth2JwtGrantIssuerRequest struct via the builder pattern Name | Type | Description | Notes | - | - | - trustOAuth2JwtGrantIssuer | | | No authorization required Content-Type: application/json Accept: application/json