Packages
ory_client
0.2.0-alpha.22
1.22.63
1.22.62
1.22.61
1.22.60
1.22.59
1.22.58
1.22.57
1.22.56
1.22.55
1.22.54
1.22.53
1.22.52
1.22.51
1.22.50
1.22.49
1.22.48
1.22.47
1.22.46
1.22.45
1.22.44
1.22.43
1.22.42
1.22.41
1.22.40
1.22.39
1.22.38
1.22.37
1.22.36
1.22.35
1.22.34
1.22.33
1.22.32
1.22.28
1.22.27
1.22.26
1.22.25
1.22.24
1.22.23
1.22.22
1.22.21
1.22.16
1.22.15
1.22.14
1.22.13
1.22.12
1.22.11
1.22.10
1.22.9
1.22.8
1.22.7
1.22.6
1.22.5
1.22.4
1.22.3
1.22.2
1.22.1
1.22.0
1.21.6
1.21.5
1.21.4
1.21.3
1.21.2
1.21.1
1.21.0
1.20.23
1.20.22
1.20.11
1.20.10
1.20.9
1.20.8
1.20.7
1.20.6
1.20.5
1.20.4
1.20.3
1.20.2
1.20.1
1.20.0
1.19.0
1.18.5
1.18.4
1.17.2
1.17.1
1.16.10
1.6.2
1.6.1
1.5.2
1.5.1
1.5.0
1.4.9
1.4.8
1.4.7
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.0
1.2.17
1.2.16
1.2.15
1.2.14
1.2.11
1.2.10
1.2.9
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.51
1.1.50
1.1.49
1.1.48
1.1.47
1.1.46
1.1.45
1.1.44
1.1.41
1.1.40
1.1.39
1.1.39-alpha.0
1.1.38
1.1.37
1.1.36
1.1.35
1.1.34
1.1.33
1.1.32
1.1.31
1.1.30
1.1.29
1.1.28
1.1.27
1.1.26
1.1.25
1.1.24
1.1.23
1.1.22
1.1.21
1.1.20
1.1.19
1.1.18
1.1.17
1.1.7
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.2
1.0.1
1.0.0
1.0.0-alpha.0
0.2.0-alpha.60
0.2.0-alpha.48
0.2.0-alpha.47
0.2.0-alpha.46
0.2.0-alpha.45
0.2.0-alpha.44
0.2.0-alpha.43
0.2.0-alpha.42
0.2.0-alpha.41
0.2.0-alpha.40
0.2.0-alpha.39
0.2.0-alpha.38
0.2.0-alpha.37
0.2.0-alpha.36
0.2.0-alpha.35
0.2.0-alpha.34
0.2.0-alpha.33
0.2.0-alpha.32
0.2.0-alpha.31
0.2.0-alpha.30
0.2.0-alpha.29
0.2.0-alpha.28
0.2.0-alpha.27
0.2.0-alpha.26
0.2.0-alpha.25
0.2.0-alpha.24
0.2.0-alpha.23
0.2.0-alpha.22
0.2.0-alpha.21
0.2.0-alpha.20
0.2.0-alpha.19
0.2.0-alpha.18
0.2.0-alpha.16
0.2.0-alpha.15
0.2.0-alpha.14
0.2.0-alpha.4
0.2.0-alpha.2
0.1.0-alpha.12
0.1.0-alpha.11
0.1.0-alpha.10
0.1.0-alpha.9
0.1.0-alpha.8
0.1.0-alpha.7
0.1.0-alpha.6
0.1.0-alpha.5
0.1.0-alpha.4
0.1.0-alpha.3
0.1.0-alpha.2
0.1.0-alpha.1
0.0.1-alpha.189
0.0.1-alpha.188
0.0.1-alpha.187
OpenAPI API client for Ory Network, Ory's web-scale API for identity and access control.
Current section
Files
Jump to
Current section
Files
lib/ory/api/v0alpha2.ex
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.
defmodule Ory.Api.V0alpha2 do
@moduledoc """
API calls for all endpoints tagged `V0alpha2`.
"""
alias Ory.Connection
import Ory.RequestBuilder
@doc """
Accept an OAuth 2.0 Consent Request
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated, he/she must now be asked if the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the subject's behalf. The consent provider which handles this request and is a web app implemented and hosted by you. It shows a subject interface which asks the subject to grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write access to all your private files\"). The consent challenge is appended to the consent provider's URL to which the subject's user-agent (browser) is redirected to. The consent provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if the subject accepted or rejected the request. This endpoint tells ORY Hydra that the subject has authorized the OAuth 2.0 client to access resources on his/her behalf. The consent provider includes additional information, such as session data for access and ID tokens, and if the consent request should be used as basis for future requests. The response contains a redirect URL which the consent provider should redirect the user-agent to.
## Parameters
- connection (Ory.Connection): Connection to server
- consent_challenge (String.t):
- opts (KeywordList): [optional] Optional parameters
- :body (AcceptOAuth2ConsentRequest):
## Returns
{:ok, Ory.Model.SuccessfulOAuth2RequestResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_accept_o_auth2_consent_request(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.SuccessfulOAuth2RequestResponse.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_accept_o_auth2_consent_request(connection, consent_challenge, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:put)
|> url("/admin/oauth2/auth/requests/consent/accept")
|> add_param(:query, :consent_challenge, consent_challenge)
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SuccessfulOAuth2RequestResponse{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Accept an OAuth 2.0 Login Request
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory Hydra asks the login provider (sometimes called \"identity provider\") to authenticate the subject and then tell Ory Hydra now about it. The login provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a login screen\") a subject (in OAuth2 the proper name for subject is \"resource owner\"). The authentication challenge is appended to the login provider URL to which the subject's user-agent (browser) is redirected to. The login provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process. This endpoint tells ORY Hydra that the subject has successfully authenticated and includes additional information such as the subject's ID and if ORY Hydra should remember the subject's subject agent for future authentication attempts by setting a cookie. The response contains a redirect URL which the login provider should redirect the user-agent to.
## Parameters
- connection (Ory.Connection): Connection to server
- login_challenge (String.t):
- opts (KeywordList): [optional] Optional parameters
- :body (AcceptOAuth2LoginRequest):
## Returns
{:ok, Ory.Model.SuccessfulOAuth2RequestResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_accept_o_auth2_login_request(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.SuccessfulOAuth2RequestResponse.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_accept_o_auth2_login_request(connection, login_challenge, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:put)
|> url("/admin/oauth2/auth/requests/login/accept")
|> add_param(:query, :login_challenge, login_challenge)
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SuccessfulOAuth2RequestResponse{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Accept an OAuth 2.0 Logout Request
When a user or an application requests ORY Hydra to log out a user, this endpoint is used to confirm that logout request. The response contains a redirect URL which the consent provider should redirect the user-agent to.
## Parameters
- connection (Ory.Connection): Connection to server
- logout_challenge (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.SuccessfulOAuth2RequestResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_accept_o_auth2_logout_request(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.SuccessfulOAuth2RequestResponse.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_accept_o_auth2_logout_request(connection, logout_challenge, _opts \\ []) do
%{}
|> method(:put)
|> url("/admin/oauth2/auth/requests/logout/accept")
|> add_param(:query, :logout_challenge, logout_challenge)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SuccessfulOAuth2RequestResponse{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Create an Identity
This endpoint creates an identity. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :body (AdminCreateIdentityBody):
## Returns
{:ok, Ory.Model.Identity.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_create_identity(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.Identity.t} | {:error, Tesla.Env.t}
def admin_create_identity(connection, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:post)
|> url("/admin/identities")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 201, %Ory.Model.Identity{}},
{ 400, %Ory.Model.JsonError{}},
{ 409, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Generate a New JSON Web Key
This endpoint is capable of generating JSON Web Key Sets for you. There a different strategies available, such as symmetric cryptographic keys (HS256, HS512) and asymetric cryptographic keys (RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created. A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
## Parameters
- connection (Ory.Connection): Connection to server
- set (String.t): The JSON Web Key Set
- admin_create_json_web_key_set_body (AdminCreateJsonWebKeySetBody):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.JsonWebKeySet.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_create_json_web_key_set(Tesla.Env.client, String.t, Ory.Model.AdminCreateJsonWebKeySetBody.t, keyword()) :: {:ok, Ory.Model.JsonWebKeySet.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_create_json_web_key_set(connection, set, admin_create_json_web_key_set_body, _opts \\ []) do
%{}
|> method(:post)
|> url("/admin/keys/#{set}")
|> add_param(:body, :body, admin_create_json_web_key_set_body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 201, %Ory.Model.JsonWebKeySet{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Create an OAuth 2.0 Client
Create a new OAuth 2.0 client. If you pass `client_secret` the secret is used, otherwise a random secret is generated. The secret is echoed in the response. It is not possible to retrieve it later on. OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
## Parameters
- connection (Ory.Connection): Connection to server
- o_auth2_client (OAuth2Client):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OAuth2Client.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_create_o_auth2_client(Tesla.Env.client, Ory.Model.OAuth2Client.t, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.OAuth2Client.t} | {:error, Tesla.Env.t}
def admin_create_o_auth2_client(connection, o_auth2_client, _opts \\ []) do
%{}
|> method(:post)
|> url("/admin/clients")
|> add_param(:body, :body, o_auth2_client)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 201, %Ory.Model.OAuth2Client{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Create a Recovery Link
This endpoint creates a recovery link which should be given to the user in order for them to recover (or activate) their account.
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :body (AdminCreateSelfServiceRecoveryLinkBody):
## Returns
{:ok, Ory.Model.SelfServiceRecoveryLink.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_create_self_service_recovery_link(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.SelfServiceRecoveryLink.t} | {:ok, Ory.Model.JsonError.t} | {:error, Tesla.Env.t}
def admin_create_self_service_recovery_link(connection, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:post)
|> url("/admin/recovery/link")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceRecoveryLink{}},
{ 400, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Delete an Identity
Calling this endpoint irrecoverably and permanently deletes the identity given its ID. This action can not be undone. This endpoint returns 204 when the identity was deleted or when the identity was not found, in which case it is assumed that is has been deleted already. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): ID is the identity's ID.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_delete_identity(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:error, Tesla.Env.t}
def admin_delete_identity(connection, id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/admin/identities/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ 404, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity.
This endpoint is useful for: To forcefully logout Identity from all devices and sessions
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): ID is the identity's ID.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_delete_identity_sessions(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:error, Tesla.Env.t}
def admin_delete_identity_sessions(connection, id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/admin/identities/#{id}/sessions")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ 400, %Ory.Model.JsonError{}},
{ 401, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Delete a JSON Web Key
Use this endpoint to delete a single JSON Web Key. A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
## Parameters
- connection (Ory.Connection): Connection to server
- set (String.t): The JSON Web Key Set
- kid (String.t): The JSON Web Key ID (kid)
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_delete_json_web_key(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_delete_json_web_key(connection, set, kid, _opts \\ []) do
%{}
|> method(:delete)
|> url("/admin/keys/#{set}/#{kid}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Delete a JSON Web Key Set
Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set. A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
## Parameters
- connection (Ory.Connection): Connection to server
- set (String.t): The JSON Web Key Set
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_delete_json_web_key_set(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_delete_json_web_key_set(connection, set, _opts \\ []) do
%{}
|> method(:delete)
|> url("/admin/keys/#{set}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Deletes an OAuth 2.0 Client
Delete an existing OAuth 2.0 Client by its ID. OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities. Make sure that this endpoint is well protected and only callable by first-party components.
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The id of the OAuth 2.0 Client.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_delete_o_auth2_client(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def admin_delete_o_auth2_client(connection, id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/admin/clients/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Delete OAuth2 Access Tokens from a Client
This endpoint deletes OAuth2 access tokens issued for a client from the database
## Parameters
- connection (Ory.Connection): Connection to server
- client_id (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_delete_o_auth2_token(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_delete_o_auth2_token(connection, client_id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/admin/oauth2/tokens")
|> add_param(:query, :client_id, client_id)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Delete a Trusted OAuth2 JWT Bearer Grant Type Issuer
Use this endpoint to delete trusted JWT Bearer Grant Type Issuer. The ID is the one returned when you created the trust relationship. Once deleted, the associated issuer will no longer be able to perform the JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grant.
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The id of the desired grant
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_delete_trusted_o_auth2_jwt_grant_issuer(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def admin_delete_trusted_o_auth2_jwt_grant_issuer(connection, id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/admin/trust/grants/jwt-bearer/issuers/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Calling this endpoint extends the given session ID. If `session.earliest_possible_extend` is set it will only extend the session after the specified time has passed.
Retrieve the session ID from the `/sessions/whoami` endpoint / `toSession` SDK method.
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): ID is the session's ID.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.Session.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_extend_session(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.Session.t} | {:error, Tesla.Env.t}
def admin_extend_session(connection, id, _opts \\ []) do
%{}
|> method(:patch)
|> url("/admin/sessions/#{id}/extend")
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.Session{}},
{ 400, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Get an Identity
Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): ID must be set to the ID of identity you want to get
- opts (KeywordList): [optional] Optional parameters
- :include_credential ([String.t]): DeclassifyCredentials will declassify one or more identity's credentials Currently, only `oidc` is supported. This will return the initial OAuth 2.0 Access, Refresh and (optionally) OpenID Connect ID Token.
## Returns
{:ok, Ory.Model.Identity.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_get_identity(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.Identity.t} | {:error, Tesla.Env.t}
def admin_get_identity(connection, id, opts \\ []) do
optional_params = %{
:include_credential => :query
}
%{}
|> method(:get)
|> url("/admin/identities/#{id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.Identity{}},
{ 404, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Fetch a JSON Web Key
This endpoint returns a singular JSON Web Key. It is identified by the set and the specific key ID (kid).
## Parameters
- connection (Ory.Connection): Connection to server
- set (String.t): The JSON Web Key Set
- kid (String.t): The JSON Web Key ID (kid)
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.JsonWebKeySet.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_get_json_web_key(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, Ory.Model.JsonWebKeySet.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_get_json_web_key(connection, set, kid, _opts \\ []) do
%{}
|> method(:get)
|> url("/admin/keys/#{set}/#{kid}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.JsonWebKeySet{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Retrieve a JSON Web Key Set
This endpoint can be used to retrieve JWK Sets stored in ORY Hydra. A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
## Parameters
- connection (Ory.Connection): Connection to server
- set (String.t): The JSON Web Key Set
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.JsonWebKeySet.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_get_json_web_key_set(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonWebKeySet.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_get_json_web_key_set(connection, set, _opts \\ []) do
%{}
|> method(:get)
|> url("/admin/keys/#{set}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.JsonWebKeySet{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Get an OAuth 2.0 Client
Get an OAuth 2.0 client by its ID. This endpoint never returns the client secret. OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The id of the OAuth 2.0 Client.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OAuth2Client.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_get_o_auth2_client(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.OAuth2Client.t} | {:error, Tesla.Env.t}
def admin_get_o_auth2_client(connection, id, _opts \\ []) do
%{}
|> method(:get)
|> url("/admin/clients/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.OAuth2Client{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Get OAuth 2.0 Consent Request Information
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated, he/she must now be asked if the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the subject's behalf. The consent provider which handles this request and is a web app implemented and hosted by you. It shows a subject interface which asks the subject to grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write access to all your private files\"). The consent challenge is appended to the consent provider's URL to which the subject's user-agent (browser) is redirected to. The consent provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if the subject accepted or rejected the request.
## Parameters
- connection (Ory.Connection): Connection to server
- consent_challenge (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OAuth2ConsentRequest.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_get_o_auth2_consent_request(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.OAuth2ConsentRequest.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:ok, Ory.Model.HandledOAuth2ConsentRequest.t} | {:error, Tesla.Env.t}
def admin_get_o_auth2_consent_request(connection, consent_challenge, _opts \\ []) do
%{}
|> method(:get)
|> url("/admin/oauth2/auth/requests/consent")
|> add_param(:query, :consent_challenge, consent_challenge)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.OAuth2ConsentRequest{}},
{ 410, %Ory.Model.HandledOAuth2ConsentRequest{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Get an OAuth 2.0 Login Request
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider (sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now about it. The login provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a login screen\") a subject (in OAuth2 the proper name for subject is \"resource owner\"). The authentication challenge is appended to the login provider URL to which the subject's user-agent (browser) is redirected to. The login provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.
## Parameters
- connection (Ory.Connection): Connection to server
- login_challenge (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OAuth2LoginRequest.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_get_o_auth2_login_request(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.OAuth2ApiError.t} | {:ok, Ory.Model.OAuth2LoginRequest.t} | {:ok, Ory.Model.HandledOAuth2LoginRequest.t} | {:error, Tesla.Env.t}
def admin_get_o_auth2_login_request(connection, login_challenge, _opts \\ []) do
%{}
|> method(:get)
|> url("/admin/oauth2/auth/requests/login")
|> add_param(:query, :login_challenge, login_challenge)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.OAuth2LoginRequest{}},
{ 410, %Ory.Model.HandledOAuth2LoginRequest{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Get an OAuth 2.0 Logout Request
Use this endpoint to fetch a logout request.
## Parameters
- connection (Ory.Connection): Connection to server
- logout_challenge (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OAuth2LogoutRequest.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_get_o_auth2_logout_request(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.OAuth2LogoutRequest.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:ok, Ory.Model.HandledOAuth2LogoutRequest.t} | {:error, Tesla.Env.t}
def admin_get_o_auth2_logout_request(connection, logout_challenge, _opts \\ []) do
%{}
|> method(:get)
|> url("/admin/oauth2/auth/requests/logout")
|> add_param(:query, :logout_challenge, logout_challenge)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.OAuth2LogoutRequest{}},
{ 410, %Ory.Model.HandledOAuth2LogoutRequest{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Get a Trusted OAuth2 JWT Bearer Grant Type Issuer
Use this endpoint to get a trusted JWT Bearer Grant Type Issuer. The ID is the one returned when you created the trust relationship.
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The id of the desired grant
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.TrustedOAuth2JwtGrantIssuer.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_get_trusted_o_auth2_jwt_grant_issuer(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.TrustedOAuth2JwtGrantIssuer.t} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def admin_get_trusted_o_auth2_jwt_grant_issuer(connection, id, _opts \\ []) do
%{}
|> method(:get)
|> url("/admin/trust/grants/jwt-bearer/issuers/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.TrustedOAuth2JwtGrantIssuer{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Introspect OAuth2 Access or Refresh Tokens
The introspection endpoint allows to check if a token (both refresh and access) is active or not. An active token is neither expired nor revoked. If a token is active, additional information on the token will be included. You can set additional data for a token by setting `accessTokenExtra` during the consent flow. For more information [read this blog post](https://www.oauth.com/oauth2-servers/token-introspection-endpoint/).
## Parameters
- connection (Ory.Connection): Connection to server
- token (String.t): The string value of the token. For access tokens, this is the \\\"access_token\\\" value returned from the token endpoint defined in OAuth 2.0. For refresh tokens, this is the \\\"refresh_token\\\" value returned.
- opts (KeywordList): [optional] Optional parameters
- :scope (String.t): 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.
## Returns
{:ok, Ory.Model.IntrospectedOAuth2Token.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_introspect_o_auth2_token(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.OAuth2ApiError.t} | {:ok, Ory.Model.IntrospectedOAuth2Token.t} | {:error, Tesla.Env.t}
def admin_introspect_o_auth2_token(connection, token, opts \\ []) do
optional_params = %{
:scope => :form
}
%{}
|> method(:post)
|> url("/admin/oauth2/introspect")
|> add_param(:form, :token, token)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.IntrospectedOAuth2Token{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
List Identities
Lists all identities. Does not support search at the moment. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :per_page (integer()): Items per Page This is the number of items per page.
- :page (integer()): Pagination Page This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist.
## Returns
{:ok, [%Identity{}, ...]} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_list_identities(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, list(Ory.Model.Identity.t)} | {:error, Tesla.Env.t}
def admin_list_identities(connection, opts \\ []) do
optional_params = %{
:per_page => :query,
:page => :query
}
%{}
|> method(:get)
|> url("/admin/identities")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, [%Ory.Model.Identity{}]},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
This endpoint returns all sessions that belong to the given Identity.
This endpoint is useful for: Listing all sessions that belong to an Identity in an administrative context.
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): ID is the identity's ID.
- opts (KeywordList): [optional] Optional parameters
- :per_page (integer()): Items per Page This is the number of items per page.
- :page (integer()): Pagination Page This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist.
- :active (boolean()): Active is a boolean flag that filters out sessions based on the state. If no value is provided, all sessions are returned.
## Returns
{:ok, [%Session{}, ...]} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_list_identity_sessions(Tesla.Env.client, String.t, keyword()) :: {:ok, list(Ory.Model.Session.t)} | {:ok, Ory.Model.JsonError.t} | {:error, Tesla.Env.t}
def admin_list_identity_sessions(connection, id, opts \\ []) do
optional_params = %{
:per_page => :query,
:page => :query,
:active => :query
}
%{}
|> method(:get)
|> url("/admin/identities/#{id}/sessions")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, [%Ory.Model.Session{}]},
{ 400, %Ory.Model.JsonError{}},
{ 401, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
List OAuth 2.0 Clients
This endpoint lists all clients in the database, and never returns client secrets. As a default it lists the first 100 clients. The `limit` parameter can be used to retrieve more clients, but it has an upper bound at 500 objects. Pagination should be used to retrieve more than 500 objects. OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities. The \"Link\" header is also included in successful responses, which contains one or more links for pagination, formatted like so: '<https://project-slug.projects.oryapis.com/admin/clients?limit={limit}&offset={offset}>; rel=\"{page}\"', where page is one of the following applicable pages: 'first', 'next', 'last', and 'previous'. Multiple links can be included in this header, and will be separated by a comma.
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :page_size (integer()): Items per page This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
- :page_token (String.t): Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
- :client_name (String.t): The name of the clients to filter by.
- :owner (String.t): The owner of the clients to filter by.
## Returns
{:ok, [%OAuth2Client{}, ...]} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_list_o_auth2_clients(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, list(Ory.Model.OAuth2Client.t)} | {:error, Tesla.Env.t}
def admin_list_o_auth2_clients(connection, opts \\ []) do
optional_params = %{
:page_size => :query,
:page_token => :query,
:client_name => :query,
:owner => :query
}
%{}
|> method(:get)
|> url("/admin/clients")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, [%Ory.Model.OAuth2Client{}]},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
List OAuth 2.0 Consent Sessions of a Subject
This endpoint lists all subject's granted consent sessions, including client and granted scope. If the subject is unknown or has not granted any consent sessions yet, the endpoint returns an empty JSON array with status code 200 OK. The \"Link\" header is also included in successful responses, which contains one or more links for pagination, formatted like so: '<https://hydra-url/admin/oauth2/auth/sessions/consent?subject={user}&limit={limit}&offset={offset}>; rel=\"{page}\"', where page is one of the following applicable pages: 'first', 'next', 'last', and 'previous'. Multiple links can be included in this header, and will be separated by a comma.
## Parameters
- connection (Ory.Connection): Connection to server
- subject (String.t): The subject to list the consent sessions for.
- opts (KeywordList): [optional] Optional parameters
- :link (String.t): The link header contains pagination links. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
- :x_total_count (String.t): The total number of clients.
## Returns
{:ok, [%PreviousOAuth2ConsentSession{}, ...]} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_list_o_auth2_subject_consent_sessions(Tesla.Env.client, String.t, keyword()) :: {:ok, list(Ory.Model.PreviousOAuth2ConsentSession.t)} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_list_o_auth2_subject_consent_sessions(connection, subject, opts \\ []) do
optional_params = %{
:link => :headers,
:"x-total-count" => :headers
}
%{}
|> method(:get)
|> url("/admin/oauth2/auth/sessions/consent")
|> add_param(:query, :subject, subject)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, [%Ory.Model.PreviousOAuth2ConsentSession{}]},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
List Trusted OAuth2 JWT Bearer Grant Type Issuers
Use this endpoint to list all trusted JWT Bearer Grant Type Issuers.
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :max_items (integer()):
- :default_items (integer()):
- :issuer (String.t): If optional \"issuer\" is supplied, only jwt-bearer grants with this issuer will be returned.
- :limit (integer()): The maximum amount of policies returned, upper bound is 500 policies
- :offset (integer()): The offset from where to start looking.
## Returns
{:ok, [%TrustedOAuth2JwtGrantIssuer{}, ...]} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_list_trusted_o_auth2_jwt_grant_issuers(Tesla.Env.client, keyword()) :: {:ok, list(Ory.Model.TrustedOAuth2JwtGrantIssuer.t)} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def admin_list_trusted_o_auth2_jwt_grant_issuers(connection, opts \\ []) do
optional_params = %{
:MaxItems => :query,
:DefaultItems => :query,
:issuer => :query,
:limit => :query,
:offset => :query
}
%{}
|> method(:get)
|> url("/admin/trust/grants/jwt-bearer/issuers")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, [%Ory.Model.TrustedOAuth2JwtGrantIssuer{}]},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Partially updates an Identity's field using [JSON Patch](https://jsonpatch.com/)
NOTE: The fields `id`, `stateChangedAt` and `credentials` are not updateable. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): ID must be set to the ID of identity you want to update
- opts (KeywordList): [optional] Optional parameters
- :body ([Ory.Model.JsonPatch.t]):
## Returns
{:ok, Ory.Model.Identity.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_patch_identity(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.Identity.t} | {:error, Tesla.Env.t}
def admin_patch_identity(connection, id, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:patch)
|> url("/admin/identities/#{id}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.Identity{}},
{ 400, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 409, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Patch an OAuth 2.0 Client
Patch an existing OAuth 2.0 Client. If you pass `client_secret` the secret will be updated and returned via the API. This is the only time you will be able to retrieve the client secret, so write it down and keep it safe. OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The id of the OAuth 2.0 Client.
- json_patch ([Ory.Model.JsonPatch.t]):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OAuth2Client.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_patch_o_auth2_client(Tesla.Env.client, String.t, list(Ory.Model.JsonPatch.t), keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.OAuth2Client.t} | {:error, Tesla.Env.t}
def admin_patch_o_auth2_client(connection, id, json_patch, _opts \\ []) do
%{}
|> method(:patch)
|> url("/admin/clients/#{id}")
|> add_param(:body, :body, json_patch)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.OAuth2Client{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Reject an OAuth 2.0 Consent Request
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated, he/she must now be asked if the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the subject's behalf. The consent provider which handles this request and is a web app implemented and hosted by you. It shows a subject interface which asks the subject to grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write access to all your private files\"). The consent challenge is appended to the consent provider's URL to which the subject's user-agent (browser) is redirected to. The consent provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if the subject accepted or rejected the request. This endpoint tells ORY Hydra that the subject has not authorized the OAuth 2.0 client to access resources on his/her behalf. The consent provider must include a reason why the consent was not granted. The response contains a redirect URL which the consent provider should redirect the user-agent to.
## Parameters
- connection (Ory.Connection): Connection to server
- consent_challenge (String.t):
- opts (KeywordList): [optional] Optional parameters
- :body (RejectOAuth2Request):
## Returns
{:ok, Ory.Model.SuccessfulOAuth2RequestResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_reject_o_auth2_consent_request(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.SuccessfulOAuth2RequestResponse.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_reject_o_auth2_consent_request(connection, consent_challenge, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:put)
|> url("/admin/oauth2/auth/requests/consent/reject")
|> add_param(:query, :consent_challenge, consent_challenge)
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SuccessfulOAuth2RequestResponse{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Reject an OAuth 2.0 Login Request
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider (sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now about it. The login provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a login screen\") a subject (in OAuth2 the proper name for subject is \"resource owner\"). The authentication challenge is appended to the login provider URL to which the subject's user-agent (browser) is redirected to. The login provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process. This endpoint tells ORY Hydra that the subject has not authenticated and includes a reason why the authentication was denied. The response contains a redirect URL which the login provider should redirect the user-agent to.
## Parameters
- connection (Ory.Connection): Connection to server
- login_challenge (String.t):
- opts (KeywordList): [optional] Optional parameters
- :body (RejectOAuth2Request):
## Returns
{:ok, Ory.Model.SuccessfulOAuth2RequestResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_reject_o_auth2_login_request(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.SuccessfulOAuth2RequestResponse.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_reject_o_auth2_login_request(connection, login_challenge, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:put)
|> url("/admin/oauth2/auth/requests/login/reject")
|> add_param(:query, :login_challenge, login_challenge)
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SuccessfulOAuth2RequestResponse{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Reject an OAuth 2.0 Logout Request
When a user or an application requests ORY Hydra to log out a user, this endpoint is used to deny that logout request. No body is required. The response is empty as the logout provider has to chose what action to perform next.
## Parameters
- connection (Ory.Connection): Connection to server
- logout_challenge (String.t):
- opts (KeywordList): [optional] Optional parameters
- :body (RejectOAuth2Request):
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_reject_o_auth2_logout_request(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_reject_o_auth2_logout_request(connection, logout_challenge, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:put)
|> url("/admin/oauth2/auth/requests/logout/reject")
|> add_param(:query, :logout_challenge, logout_challenge)
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Revokes OAuth 2.0 Consent Sessions of a Subject for a Specific OAuth 2.0 Client
This endpoint revokes a subject's granted consent sessions for a specific OAuth 2.0 Client and invalidates all associated OAuth 2.0 Access Tokens.
## Parameters
- connection (Ory.Connection): Connection to server
- subject (String.t): The subject (Subject) whose consent sessions should be deleted.
- opts (KeywordList): [optional] Optional parameters
- :client (String.t): If set, deletes only those consent sessions by the Subject that have been granted to the specified OAuth 2.0 Client ID
- :all (boolean()): If set to `true` deletes all consent sessions by the Subject that have been granted.
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_revoke_o_auth2_consent_sessions(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_revoke_o_auth2_consent_sessions(connection, subject, opts \\ []) do
optional_params = %{
:client => :query,
:all => :query
}
%{}
|> method(:delete)
|> url("/admin/oauth2/auth/sessions/consent")
|> add_param(:query, :subject, subject)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Invalidates All OAuth 2.0 Login Sessions of a Certain User
This endpoint invalidates a subject's authentication session. After revoking the authentication session, the subject has to re-authenticate at ORY Hydra. This endpoint does not invalidate any tokens and does not work with OpenID Connect Front- or Back-channel logout.
## Parameters
- connection (Ory.Connection): Connection to server
- subject (String.t): The subject to revoke authentication sessions for.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_revoke_o_auth2_login_sessions(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_revoke_o_auth2_login_sessions(connection, subject, _opts \\ []) do
%{}
|> method(:delete)
|> url("/admin/oauth2/auth/sessions/login")
|> add_param(:query, :subject, subject)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Trust an OAuth2 JWT Bearer Grant Type Issuer
Use this endpoint to establish a trust relationship for a JWT issuer to perform JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants [RFC7523](https://datatracker.ietf.org/doc/html/rfc7523).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :body (AdminTrustOAuth2JwtGrantIssuerBody):
## Returns
{:ok, Ory.Model.TrustedOAuth2JwtGrantIssuer.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_trust_o_auth2_jwt_grant_issuer(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.TrustedOAuth2JwtGrantIssuer.t} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def admin_trust_o_auth2_jwt_grant_issuer(connection, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:post)
|> url("/admin/trust/grants/jwt-bearer/issuers")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 201, %Ory.Model.TrustedOAuth2JwtGrantIssuer{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Update an Identity
This endpoint updates an identity. The full identity payload (except credentials) is expected. This endpoint does not support patching. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): ID must be set to the ID of identity you want to update
- opts (KeywordList): [optional] Optional parameters
- :body (AdminUpdateIdentityBody):
## Returns
{:ok, Ory.Model.Identity.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_update_identity(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.Identity.t} | {:error, Tesla.Env.t}
def admin_update_identity(connection, id, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:put)
|> url("/admin/identities/#{id}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.Identity{}},
{ 400, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 409, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Update a JSON Web Key
Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own. A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
## Parameters
- connection (Ory.Connection): Connection to server
- set (String.t): The JSON Web Key Set
- kid (String.t): The JSON Web Key ID (kid)
- opts (KeywordList): [optional] Optional parameters
- :body (JsonWebKey):
## Returns
{:ok, Ory.Model.JsonWebKey.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_update_json_web_key(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, Ory.Model.OAuth2ApiError.t} | {:ok, Ory.Model.JsonWebKey.t} | {:error, Tesla.Env.t}
def admin_update_json_web_key(connection, set, kid, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:put)
|> url("/admin/keys/#{set}/#{kid}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.JsonWebKey{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Update a JSON Web Key Set
Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own. A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.
## Parameters
- connection (Ory.Connection): Connection to server
- set (String.t): The JSON Web Key Set
- opts (KeywordList): [optional] Optional parameters
- :body (JsonWebKeySet):
## Returns
{:ok, Ory.Model.JsonWebKeySet.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_update_json_web_key_set(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonWebKeySet.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def admin_update_json_web_key_set(connection, set, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:put)
|> url("/admin/keys/#{set}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.JsonWebKeySet{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Update an OAuth 2.0 Client
Update an existing OAuth 2.0 Client. If you pass `client_secret` the secret is used, otherwise a random secret is generated. The secret is echoed in the response. It is not possible to retrieve it later on. OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The id of the OAuth 2.0 Client.
- o_auth2_client (OAuth2Client):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OAuth2Client.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec admin_update_o_auth2_client(Tesla.Env.client, String.t, Ory.Model.OAuth2Client.t, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.OAuth2Client.t} | {:error, Tesla.Env.t}
def admin_update_o_auth2_client(connection, id, o_auth2_client, _opts \\ []) do
%{}
|> method(:put)
|> url("/admin/clients/#{id}")
|> add_param(:body, :body, o_auth2_client)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.OAuth2Client{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Create a Project
Creates a new project.
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :body (CreateProjectBody):
## Returns
{:ok, Ory.Model.Project.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec create_project(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.Project.t} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def create_project(connection, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:post)
|> url("/projects")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 201, %Ory.Model.Project{}},
{ 401, %Ory.Model.GenericError{}},
{ 403, %Ory.Model.GenericError{}},
{ 404, %Ory.Model.GenericError{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Create a Logout URL for Browsers
This endpoint initializes a browser-based user logout flow and a URL which can be used to log out the user. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). For API clients you can call the `/self-service/logout/api` URL directly with the Ory Session Token. The URL is only valid for the currently signed in user. If no user is signed in, this endpoint returns a 401 error. When calling this endpoint from a backend, please ensure to properly forward the HTTP cookies.
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :cookie (String.t): HTTP Cookies If you call this endpoint from a backend, please include the original Cookie header in the request.
## Returns
{:ok, Ory.Model.SelfServiceLogoutUrl.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec create_self_service_logout_flow_url_for_browsers(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceLogoutUrl.t} | {:error, Tesla.Env.t}
def create_self_service_logout_flow_url_for_browsers(connection, opts \\ []) do
optional_params = %{
:cookie => :headers
}
%{}
|> method(:get)
|> url("/self-service/logout/browser")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceLogoutUrl{}},
{ 401, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Discover JSON Web Keys
This endpoint returns JSON Web Keys required to verifying OpenID Connect ID Tokens and, if enabled, OAuth 2.0 JWT Access Tokens. This endpoint can be used with client libraries like [node-jwks-rsa](https://github.com/auth0/node-jwks-rsa) among others.
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.JsonWebKeySet.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec discover_json_web_keys(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.JsonWebKeySet.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def discover_json_web_keys(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/.well-known/jwks.json")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.JsonWebKeySet{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
OpenID Connect Discovery
The well known endpoint an be used to retrieve information for OpenID Connect clients. We encourage you to not roll your own OpenID Connect client but to use an OpenID Connect client library instead. You can learn more on this flow at https://openid.net/specs/openid-connect-discovery-1_0.html . Popular libraries for OpenID Connect clients include oidc-client-js (JavaScript), go-oidc (Golang), and others. For a full list of clients go here: https://openid.net/developers/certified/
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OidcConfiguration.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec discover_oidc_configuration(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.OidcConfiguration.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def discover_oidc_configuration(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/.well-known/openid-configuration")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.OidcConfiguration{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Register an OAuth 2.0 Client using the OpenID / OAuth2 Dynamic Client Registration Management Protocol
This endpoint behaves like the administrative counterpart (`createOAuth2Client`) but is capable of facing the public internet directly and can be used in self-service. It implements the OpenID Connect Dynamic Client Registration Protocol. This feature needs to be enabled in the configuration. This endpoint is disabled by default. It can be enabled by an administrator. Please note that using this endpoint you are not able to choose the `client_secret` nor the `client_id` as those values will be server generated when specifying `token_endpoint_auth_method` as `client_secret_basic` or `client_secret_post`. The `client_secret` will be returned in the response and you will not be able to retrieve it later on. Write the secret down and keep it somewhere safe.
## Parameters
- connection (Ory.Connection): Connection to server
- o_auth2_client (OAuth2Client):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OAuth2Client.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec dynamic_client_registration_create_o_auth2_client(Tesla.Env.client, Ory.Model.OAuth2Client.t, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.OAuth2Client.t} | {:error, Tesla.Env.t}
def dynamic_client_registration_create_o_auth2_client(connection, o_auth2_client, _opts \\ []) do
%{}
|> method(:post)
|> url("/oauth2/register")
|> add_param(:body, :body, o_auth2_client)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 201, %Ory.Model.OAuth2Client{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Deletes an OAuth 2.0 Client using the OpenID / OAuth2 Dynamic Client Registration Management Protocol
This endpoint behaves like the administrative counterpart (`deleteOAuth2Client`) but is capable of facing the public internet directly and can be used in self-service. It implements the OpenID Connect Dynamic Client Registration Protocol. This feature needs to be enabled in the configuration. This endpoint is disabled by default. It can be enabled by an administrator. To use this endpoint, you will need to present the client's authentication credentials. If the OAuth2 Client uses the Token Endpoint Authentication Method `client_secret_post`, you need to present the client secret in the URL query. If it uses `client_secret_basic`, present the Client ID and the Client Secret in the Authorization header. OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The id of the OAuth 2.0 Client.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec dynamic_client_registration_delete_o_auth2_client(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def dynamic_client_registration_delete_o_auth2_client(connection, id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/oauth2/register/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Get an OAuth 2.0 Client using the OpenID / OAuth2 Dynamic Client Registration Management Protocol
This endpoint behaves like the administrative counterpart (`getOAuth2Client`) but is capable of facing the public internet directly and can be used in self-service. It implements the OpenID Connect Dynamic Client Registration Protocol. This feature needs to be enabled in the configuration. This endpoint is disabled by default. It can be enabled by an administrator. To use this endpoint, you will need to present the client's authentication credentials. If the OAuth2 Client uses the Token Endpoint Authentication Method `client_secret_post`, you need to present the client secret in the URL query. If it uses `client_secret_basic`, present the Client ID and the Client Secret in the Authorization header. OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The id of the OAuth 2.0 Client.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OAuth2Client.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec dynamic_client_registration_get_o_auth2_client(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.OAuth2Client.t} | {:error, Tesla.Env.t}
def dynamic_client_registration_get_o_auth2_client(connection, id, _opts \\ []) do
%{}
|> method(:get)
|> url("/oauth2/register/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.OAuth2Client{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Update an OAuth 2.0 Client using the OpenID / OAuth2 Dynamic Client Registration Management Protocol
This endpoint behaves like the administrative counterpart (`updateOAuth2Client`) but is capable of facing the public internet directly and can be used in self-service. It implements the OpenID Connect Dynamic Client Registration Protocol. This feature needs to be enabled in the configuration. This endpoint is disabled by default. It can be enabled by an administrator. If you pass `client_secret` the secret is used, otherwise a random secret is generated. The secret is echoed in the response. It is not possible to retrieve it later on. To use this endpoint, you will need to present the client's authentication credentials. If the OAuth2 Client uses the Token Endpoint Authentication Method `client_secret_post`, you need to present the client secret in the URL query. If it uses `client_secret_basic`, present the Client ID and the Client Secret in the Authorization header. OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The id of the OAuth 2.0 Client.
- o_auth2_client (OAuth2Client):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OAuth2Client.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec dynamic_client_registration_update_o_auth2_client(Tesla.Env.client, String.t, Ory.Model.OAuth2Client.t, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.OAuth2Client.t} | {:error, Tesla.Env.t}
def dynamic_client_registration_update_o_auth2_client(connection, id, o_auth2_client, _opts \\ []) do
%{}
|> method(:put)
|> url("/oauth2/register/#{id}")
|> add_param(:body, :body, o_auth2_client)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.OAuth2Client{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Get a JSON Schema
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): ID must be set to the ID of schema you want to get
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, map()} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_identity_schema(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Map.t} | {:error, Tesla.Env.t}
def get_identity_schema(connection, id, _opts \\ []) do
%{}
|> method(:get)
|> url("/schemas/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %{}},
{ 404, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
OpenID Connect Userinfo
This endpoint returns the payload of the ID Token, including the idTokenExtra values, of the provided OAuth 2.0 Access Token. For more information please [refer to the spec](http://openid.net/specs/openid-connect-core-1_0.html#UserInfo). In the case of authentication error, a WWW-Authenticate header might be set in the response with more information about the error. See [the spec](https://datatracker.ietf.org/doc/html/rfc6750#section-3) for more details about header format.
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OidcUserInfo.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_oidc_user_info(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.OAuth2ApiError.t} | {:ok, Ory.Model.OidcUserInfo.t} | {:error, Tesla.Env.t}
def get_oidc_user_info(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/userinfo")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.OidcUserInfo{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Get a Project
Get a projects you have access to by its ID.
## Parameters
- connection (Ory.Connection): Connection to server
- project_id (String.t): Project ID The project's ID.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.Project.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_project(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.Project.t} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def get_project(connection, project_id, _opts \\ []) do
%{}
|> method(:get)
|> url("/projects/#{project_id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.Project{}},
{ 401, %Ory.Model.GenericError{}},
{ 403, %Ory.Model.GenericError{}},
{ 404, %Ory.Model.GenericError{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Get all members associated with this project.
This endpoint requires the user to be a member of the project with the role `OWNER` or `DEVELOPER`.
## Parameters
- connection (Ory.Connection): Connection to server
- project_id (String.t): Project ID The project's ID.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, [%CloudAccount{}, ...]} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_project_members(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, list(Ory.Model.CloudAccount.t)} | {:error, Tesla.Env.t}
def get_project_members(connection, project_id, _opts \\ []) do
%{}
|> method(:get)
|> url("/projects/#{project_id}/members")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, [%Ory.Model.CloudAccount{}]},
{ 401, %Ory.Model.GenericError{}},
{ 406, %Ory.Model.GenericError{}},
{ 500, %Ory.Model.GenericError{}}
])
end
@doc """
Get Self-Service Errors
This endpoint returns the error associated with a user-facing self service errors. This endpoint supports stub values to help you implement the error UI: `?id=stub:500` - returns a stub 500 (Internal Server Error) error. More information can be found at [Ory Kratos User User Facing Error Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-facing-errors).
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): Error is the error's ID
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.SelfServiceError.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_self_service_error(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceError.t} | {:error, Tesla.Env.t}
def get_self_service_error(connection, id, _opts \\ []) do
%{}
|> method(:get)
|> url("/self-service/errors")
|> add_param(:query, :id, id)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceError{}},
{ 403, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Get Login Flow
This endpoint returns a login flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. If you use the browser-flow for server-side apps, the services need to run on a common top-level-domain and you need to forward the incoming HTTP Cookie header to this endpoint: ```js pseudo-code example router.get('/login', async function (req, res) { const flow = await client.getSelfServiceLoginFlow(req.header('cookie'), req.query['flow']) res.render('login', flow) }) ``` This request may fail due to several reasons. The `error.id` can be one of: `session_already_available`: The user is already signed in. `self_service_flow_expired`: The flow is expired and you should request a new one. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The Login Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/login?flow=abcde`).
- opts (KeywordList): [optional] Optional parameters
- :cookie (String.t): HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected.
## Returns
{:ok, Ory.Model.SelfServiceLoginFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_self_service_login_flow(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceLoginFlow.t} | {:error, Tesla.Env.t}
def get_self_service_login_flow(connection, id, opts \\ []) do
optional_params = %{
:Cookie => :headers
}
%{}
|> method(:get)
|> url("/self-service/login/flows")
|> add_param(:query, :id, id)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceLoginFlow{}},
{ 403, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 410, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Get Recovery Flow
This endpoint returns a recovery flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. If you use the browser-flow for server-side apps, the services need to run on a common top-level-domain and you need to forward the incoming HTTP Cookie header to this endpoint: ```js pseudo-code example router.get('/recovery', async function (req, res) { const flow = await client.getSelfServiceRecoveryFlow(req.header('Cookie'), req.query['flow']) res.render('recovery', flow) }) ``` More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery).
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The Flow ID The value for this parameter comes from `request` URL Query parameter sent to your application (e.g. `/recovery?flow=abcde`).
- opts (KeywordList): [optional] Optional parameters
- :cookie (String.t): HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected.
## Returns
{:ok, Ory.Model.SelfServiceRecoveryFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_self_service_recovery_flow(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceRecoveryFlow.t} | {:error, Tesla.Env.t}
def get_self_service_recovery_flow(connection, id, opts \\ []) do
optional_params = %{
:Cookie => :headers
}
%{}
|> method(:get)
|> url("/self-service/recovery/flows")
|> add_param(:query, :id, id)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceRecoveryFlow{}},
{ 404, %Ory.Model.JsonError{}},
{ 410, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Get Registration Flow
This endpoint returns a registration flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. If you use the browser-flow for server-side apps, the services need to run on a common top-level-domain and you need to forward the incoming HTTP Cookie header to this endpoint: ```js pseudo-code example router.get('/registration', async function (req, res) { const flow = await client.getSelfServiceRegistrationFlow(req.header('cookie'), req.query['flow']) res.render('registration', flow) }) ``` This request may fail due to several reasons. The `error.id` can be one of: `session_already_available`: The user is already signed in. `self_service_flow_expired`: The flow is expired and you should request a new one. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The Registration Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/registration?flow=abcde`).
- opts (KeywordList): [optional] Optional parameters
- :cookie (String.t): HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected.
## Returns
{:ok, Ory.Model.SelfServiceRegistrationFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_self_service_registration_flow(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceRegistrationFlow.t} | {:error, Tesla.Env.t}
def get_self_service_registration_flow(connection, id, opts \\ []) do
optional_params = %{
:Cookie => :headers
}
%{}
|> method(:get)
|> url("/self-service/registration/flows")
|> add_param(:query, :id, id)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceRegistrationFlow{}},
{ 403, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 410, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Get Settings Flow
When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie or the Ory Kratos Session Token are set. Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator Assurance Level (AAL) than is possible for the identity. This can happen if the identity has password + webauthn credentials (which would result in AAL2) but the session has only AAL1. If this error occurs, ask the user to sign in with the second factor or change the configuration. You can access this endpoint without credentials when using Ory Kratos' Admin API. If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `session_inactive`: No Ory Session was found - sign in a user first. `security_identity_mismatch`: The flow was interrupted with `session_refresh_required` but apparently some other identity logged in instead. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): ID is the Settings Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/settings?flow=abcde`).
- opts (KeywordList): [optional] Optional parameters
- :x_session_token (String.t): The Session Token When using the SDK in an app without a browser, please include the session token here.
- :cookie (String.t): HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected.
## Returns
{:ok, Ory.Model.SelfServiceSettingsFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_self_service_settings_flow(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceSettingsFlow.t} | {:error, Tesla.Env.t}
def get_self_service_settings_flow(connection, id, opts \\ []) do
optional_params = %{
:"X-Session-Token" => :headers,
:Cookie => :headers
}
%{}
|> method(:get)
|> url("/self-service/settings/flows")
|> add_param(:query, :id, id)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceSettingsFlow{}},
{ 401, %Ory.Model.JsonError{}},
{ 403, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 410, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Get Verification Flow
This endpoint returns a verification flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. If you use the browser-flow for server-side apps, the services need to run on a common top-level-domain and you need to forward the incoming HTTP Cookie header to this endpoint: ```js pseudo-code example router.get('/recovery', async function (req, res) { const flow = await client.getSelfServiceVerificationFlow(req.header('cookie'), req.query['flow']) res.render('verification', flow) }) More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/selfservice/flows/verify-email-account-activation).
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): The Flow ID The value for this parameter comes from `request` URL Query parameter sent to your application (e.g. `/verification?flow=abcde`).
- opts (KeywordList): [optional] Optional parameters
- :cookie (String.t): HTTP Cookies When using the SDK on the server side you must include the HTTP Cookie Header originally sent to your HTTP handler here.
## Returns
{:ok, Ory.Model.SelfServiceVerificationFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_self_service_verification_flow(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceVerificationFlow.t} | {:error, Tesla.Env.t}
def get_self_service_verification_flow(connection, id, opts \\ []) do
optional_params = %{
:cookie => :headers
}
%{}
|> method(:get)
|> url("/self-service/verification/flows")
|> add_param(:query, :id, id)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceVerificationFlow{}},
{ 403, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Get WebAuthn JavaScript
This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration. If you are building a JavaScript Browser App (e.g. in ReactJS or AngularJS) you will need to load this file: ```html <script src=\"https://public-kratos.example.org/.well-known/ory/webauthn.js\" type=\"script\" async /> ``` More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, String.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec get_web_authn_java_script(Tesla.Env.client, keyword()) :: {:ok, String.t} | {:error, Tesla.Env.t}
def get_web_authn_java_script(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/.well-known/ory/webauthn.js")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, false}
])
end
@doc """
Initialize Login Flow for Browsers
This endpoint initializes a browser-based user login flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to `selfservice.flows.login.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists already, the browser will be redirected to `urls.default_redirect_url` unless the query parameter `?refresh=true` was set. If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `session_aal1_required`: Multi-factor auth (e.g. 2fa) was requested but the user has no session yet. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `security_identity_mismatch`: The requested `?return_to` address is not allowed to be used. Adjust this in the configuration! This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :refresh (boolean()): Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session.
- :aal (String.t): Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session's authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\".
- :return_to (String.t): The URL to return the browser to after the flow was completed.
## Returns
{:ok, Ory.Model.SelfServiceLoginFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec initialize_self_service_login_flow_for_browsers(Tesla.Env.client, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceLoginFlow.t} | {:error, Tesla.Env.t}
def initialize_self_service_login_flow_for_browsers(connection, opts \\ []) do
optional_params = %{
:refresh => :query,
:aal => :query,
:return_to => :query
}
%{}
|> method(:get)
|> url("/self-service/login/browser")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceLoginFlow{}},
{ 303, false},
{ 400, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Initialize Login Flow for APIs, Services, Apps, ...
This endpoint initiates a login flow for API clients that do not use a browser, such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. To fetch an existing login flow call `/self-service/login/flows?flow=<flow_id>`. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks, including CSRF login attacks. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `session_aal1_required`: Multi-factor auth (e.g. 2fa) was requested but the user has no session yet. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :refresh (boolean()): Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session.
- :aal (String.t): Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session's authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\".
- :x_session_token (String.t): The Session Token of the Identity performing the settings flow.
## Returns
{:ok, Ory.Model.SelfServiceLoginFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec initialize_self_service_login_flow_without_browser(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceLoginFlow.t} | {:error, Tesla.Env.t}
def initialize_self_service_login_flow_without_browser(connection, opts \\ []) do
optional_params = %{
:refresh => :query,
:aal => :query,
:"X-Session-Token" => :headers
}
%{}
|> method(:get)
|> url("/self-service/login/api")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceLoginFlow{}},
{ 400, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Initialize Recovery Flow for Browsers
This endpoint initializes a browser-based account recovery flow. Once initialized, the browser will be redirected to `selfservice.flows.recovery.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists, the browser is returned to the configured return URL. If this endpoint is called via an AJAX request, the response contains the recovery flow without any redirects or a 400 bad request error if the user is already authenticated. This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :return_to (String.t): The URL to return the browser to after the flow was completed.
## Returns
{:ok, Ory.Model.SelfServiceRecoveryFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec initialize_self_service_recovery_flow_for_browsers(Tesla.Env.client, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceRecoveryFlow.t} | {:error, Tesla.Env.t}
def initialize_self_service_recovery_flow_for_browsers(connection, opts \\ []) do
optional_params = %{
:return_to => :query
}
%{}
|> method(:get)
|> url("/self-service/recovery/browser")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceRecoveryFlow{}},
{ 303, false},
{ 400, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Initialize Recovery Flow for APIs, Services, Apps, ...
This endpoint initiates a recovery flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error. To fetch an existing recovery flow call `/self-service/recovery/flows?flow=<flow_id>`. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.SelfServiceRecoveryFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec initialize_self_service_recovery_flow_without_browser(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceRecoveryFlow.t} | {:error, Tesla.Env.t}
def initialize_self_service_recovery_flow_without_browser(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/self-service/recovery/api")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceRecoveryFlow{}},
{ 400, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Initialize Registration Flow for Browsers
This endpoint initializes a browser-based user registration flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. :::info This endpoint is EXPERIMENTAL and subject to potential breaking changes in the future. ::: If this endpoint is opened as a link in the browser, it will be redirected to `selfservice.flows.registration.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists already, the browser will be redirected to `urls.default_redirect_url`. If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `security_identity_mismatch`: The requested `?return_to` address is not allowed to be used. Adjust this in the configuration! If this endpoint is called via an AJAX request, the response contains the registration flow without a redirect. This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :return_to (String.t): The URL to return the browser to after the flow was completed.
## Returns
{:ok, Ory.Model.SelfServiceRegistrationFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec initialize_self_service_registration_flow_for_browsers(Tesla.Env.client, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceRegistrationFlow.t} | {:error, Tesla.Env.t}
def initialize_self_service_registration_flow_for_browsers(connection, opts \\ []) do
optional_params = %{
:return_to => :query
}
%{}
|> method(:get)
|> url("/self-service/registration/browser")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceRegistrationFlow{}},
{ 303, false},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Initialize Registration Flow for APIs, Services, Apps, ...
This endpoint initiates a registration flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. To fetch an existing registration flow call `/self-service/registration/flows?flow=<flow_id>`. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.SelfServiceRegistrationFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec initialize_self_service_registration_flow_without_browser(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceRegistrationFlow.t} | {:error, Tesla.Env.t}
def initialize_self_service_registration_flow_without_browser(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/self-service/registration/api")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceRegistrationFlow{}},
{ 400, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Initialize Settings Flow for Browsers
This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to `selfservice.flows.settings.ui_url` with the flow ID set as the query parameter `?flow=`. If no valid Ory Kratos Session Cookie is included in the request, a login flow will be initialized. If this endpoint is opened as a link in the browser, it will be redirected to `selfservice.flows.settings.ui_url` with the flow ID set as the query parameter `?flow=`. If no valid user session was set, the browser will be redirected to the login endpoint. If this endpoint is called via an AJAX request, the response contains the settings flow without any redirects or a 401 forbidden error if no valid session was set. Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator Assurance Level (AAL) than is possible for the identity. This can happen if the identity has password + webauthn credentials (which would result in AAL2) but the session has only AAL1. If this error occurs, ask the user to sign in with the second factor (happens automatically for server-side browser flows) or change the configuration. If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `session_inactive`: No Ory Session was found - sign in a user first. `security_identity_mismatch`: The requested `?return_to` address is not allowed to be used. Adjust this in the configuration! This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :return_to (String.t): The URL to return the browser to after the flow was completed.
## Returns
{:ok, Ory.Model.SelfServiceSettingsFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec initialize_self_service_settings_flow_for_browsers(Tesla.Env.client, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceSettingsFlow.t} | {:error, Tesla.Env.t}
def initialize_self_service_settings_flow_for_browsers(connection, opts \\ []) do
optional_params = %{
:return_to => :query
}
%{}
|> method(:get)
|> url("/self-service/settings/browser")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceSettingsFlow{}},
{ 303, false},
{ 400, %Ory.Model.JsonError{}},
{ 401, %Ory.Model.JsonError{}},
{ 403, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Initialize Settings Flow for APIs, Services, Apps, ...
This endpoint initiates a settings flow for API clients such as mobile devices, smart TVs, and so on. You must provide a valid Ory Kratos Session Token for this endpoint to respond with HTTP 200 OK. To fetch an existing settings flow call `/self-service/settings/flows?flow=<flow_id>`. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator Assurance Level (AAL) than is possible for the identity. This can happen if the identity has password + webauthn credentials (which would result in AAL2) but the session has only AAL1. If this error occurs, ask the user to sign in with the second factor or change the configuration. In the case of an error, the `error.id` of the JSON response body can be one of: `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `session_inactive`: No Ory Session was found - sign in a user first. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :x_session_token (String.t): The Session Token of the Identity performing the settings flow.
## Returns
{:ok, Ory.Model.SelfServiceSettingsFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec initialize_self_service_settings_flow_without_browser(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceSettingsFlow.t} | {:error, Tesla.Env.t}
def initialize_self_service_settings_flow_without_browser(connection, opts \\ []) do
optional_params = %{
:"X-Session-Token" => :headers
}
%{}
|> method(:get)
|> url("/self-service/settings/api")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceSettingsFlow{}},
{ 400, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Initialize Verification Flow for Browser Clients
This endpoint initializes a browser-based account verification flow. Once initialized, the browser will be redirected to `selfservice.flows.verification.ui_url` with the flow ID set as the query parameter `?flow=`. If this endpoint is called via an AJAX request, the response contains the recovery flow without any redirects. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/selfservice/flows/verify-email-account-activation).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :return_to (String.t): The URL to return the browser to after the flow was completed.
## Returns
{:ok, Ory.Model.SelfServiceVerificationFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec initialize_self_service_verification_flow_for_browsers(Tesla.Env.client, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceVerificationFlow.t} | {:error, Tesla.Env.t}
def initialize_self_service_verification_flow_for_browsers(connection, opts \\ []) do
optional_params = %{
:return_to => :query
}
%{}
|> method(:get)
|> url("/self-service/verification/browser")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceVerificationFlow{}},
{ 303, false},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Initialize Verification Flow for APIs, Services, Apps, ...
This endpoint initiates a verification flow for API clients such as mobile devices, smart TVs, and so on. To fetch an existing verification flow call `/self-service/verification/flows?flow=<flow_id>`. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.SelfServiceVerificationFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec initialize_self_service_verification_flow_without_browser(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceVerificationFlow.t} | {:error, Tesla.Env.t}
def initialize_self_service_verification_flow_without_browser(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/self-service/verification/api")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceVerificationFlow{}},
{ 400, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Get all Identity Schemas
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :per_page (integer()): Items per Page This is the number of items per page.
- :page (integer()): Pagination Page This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist.
## Returns
{:ok, [%IdentitySchemaContainer{}, ...]} on success
{:error, Tesla.Env.t} on failure
"""
@spec list_identity_schemas(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, list(Ory.Model.IdentitySchemaContainer.t)} | {:error, Tesla.Env.t}
def list_identity_schemas(connection, opts \\ []) do
optional_params = %{
:per_page => :query,
:page => :query
}
%{}
|> method(:get)
|> url("/schemas")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, [%Ory.Model.IdentitySchemaContainer{}]},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
List All Projects
Lists all projects you have access to.
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, [%ProjectMetadata{}, ...]} on success
{:error, Tesla.Env.t} on failure
"""
@spec list_projects(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, list(Ory.Model.ProjectMetadata.t)} | {:error, Tesla.Env.t}
def list_projects(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/projects")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, [%Ory.Model.ProjectMetadata{}]},
{ 401, %Ory.Model.GenericError{}},
{ 403, %Ory.Model.GenericError{}},
{ 404, %Ory.Model.GenericError{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
This endpoints returns all other active sessions that belong to the logged-in user. The current session can be retrieved by calling the `/sessions/whoami` endpoint.
This endpoint is useful for: Displaying all other sessions that belong to the logged-in user
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :x_session_token (String.t): Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`.
- :cookie (String.t): Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored.
- :per_page (integer()): Items per Page This is the number of items per page.
- :page (integer()): Pagination Page This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist.
## Returns
{:ok, [%Session{}, ...]} on success
{:error, Tesla.Env.t} on failure
"""
@spec list_sessions(Tesla.Env.client, keyword()) :: {:ok, list(Ory.Model.Session.t)} | {:ok, Ory.Model.JsonError.t} | {:error, Tesla.Env.t}
def list_sessions(connection, opts \\ []) do
optional_params = %{
:"X-Session-Token" => :headers,
:Cookie => :headers,
:per_page => :query,
:page => :query
}
%{}
|> method(:get)
|> url("/sessions")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, [%Ory.Model.Session{}]},
{ 400, %Ory.Model.JsonError{}},
{ 401, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Patch an Ory Cloud Project Configuration`
Deprecated: Use the `patchProjectWithRevision` endpoint instead to specify the exact revision the patch was generated for. This endpoints allows you to patch individual Ory Cloud Project configuration keys for Ory's services (identity, permission, ...). The configuration format is fully compatible with the open source projects for the respective services (e.g. Ory Kratos for Identity, Ory Keto for Permissions). This endpoint expects the `version` key to be set in the payload. If it is unset, it will try to import the config as if it is from the most recent version. If you have an older version of a configuration, you should set the version key in the payload! While this endpoint is able to process all configuration items related to features (e.g. password reset), it does not support operational configuration items (e.g. port, tracing, logging) otherwise available in the open source. For configuration items that can not be translated to Ory Cloud, this endpoint will return a list of warnings to help you understand which parts of your config could not be processed.
## Parameters
- connection (Ory.Connection): Connection to server
- project_id (String.t): Project ID The project's ID.
- opts (KeywordList): [optional] Optional parameters
- :body ([Ory.Model.JsonPatch.t]):
## Returns
{:ok, Ory.Model.SuccessfulProjectUpdate.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec patch_project(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.SuccessfulProjectUpdate.t} | {:error, Tesla.Env.t}
def patch_project(connection, project_id, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:patch)
|> url("/projects/#{project_id}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SuccessfulProjectUpdate{}},
{ 400, %Ory.Model.GenericError{}},
{ 401, %Ory.Model.GenericError{}},
{ 403, %Ory.Model.GenericError{}},
{ 404, %Ory.Model.GenericError{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
The OAuth 2.0 Authorize Endpoint
This endpoint is not documented here because you should never use your own implementation to perform OAuth2 flows. OAuth2 is a very popular protocol and a library for your programming language will exists. To learn more about this flow please refer to the specification: https://tools.ietf.org/html/rfc6749
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, Ory.Model.OAuth2ApiError.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec perform_o_auth2_authorization_flow(Tesla.Env.client, keyword()) :: {:ok, nil} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def perform_o_auth2_authorization_flow(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/oauth2/auth")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 302, false},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
The OAuth 2.0 Token Endpoint
The client makes a request to the token endpoint by sending the following parameters using the \"application/x-www-form-urlencoded\" HTTP request entity-body. > Do not implement a client for this endpoint yourself. Use a library. There are many libraries > available for any programming language. You can find a list of libraries here: https://oauth.net/code/ > > Do note that Hydra SDK does not implement this endpoint properly. Use one of the libraries listed above
## Parameters
- connection (Ory.Connection): Connection to server
- grant_type (String.t):
- opts (KeywordList): [optional] Optional parameters
- :client_id (String.t):
- :code (String.t):
- :redirect_uri (String.t):
- :refresh_token (String.t):
## Returns
{:ok, Ory.Model.OAuth2TokenResponse.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec perform_o_auth2_token_flow(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.OAuth2TokenResponse.t} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def perform_o_auth2_token_flow(connection, grant_type, opts \\ []) do
optional_params = %{
:client_id => :form,
:code => :form,
:redirect_uri => :form,
:refresh_token => :form
}
%{}
|> method(:post)
|> url("/oauth2/token")
|> add_param(:form, :grant_type, grant_type)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.OAuth2TokenResponse{}},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
OpenID Connect Front- or Back-channel Enabled Logout
This endpoint initiates and completes user logout at Ory Hydra and initiates OpenID Connect Front- / Back-channel logout: https://openid.net/specs/openid-connect-frontchannel-1_0.html https://openid.net/specs/openid-connect-backchannel-1_0.html Back-channel logout is performed asynchronously and does not affect logout flow.
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec perform_oidc_front_or_back_channel_logout(Tesla.Env.client, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def perform_oidc_front_or_back_channel_logout(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/oauth2/sessions/logout")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 302, false}
])
end
@doc """
Irrecoverably Purge a Project
!! Use with extreme caution !! Using this API endpoint you can purge (completely delete) a project and its data. This action can not be undone and will delete ALL your data. !! Use with extreme caution !!
## Parameters
- connection (Ory.Connection): Connection to server
- project_id (String.t): Project ID The project's ID.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec purge_project(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def purge_project(connection, project_id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/projects/#{project_id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ 401, %Ory.Model.GenericError{}},
{ 403, %Ory.Model.GenericError{}},
{ 404, %Ory.Model.GenericError{}},
{ :default, %Ory.Model.GenericError{}}
])
end
@doc """
Remove a member associated with this project. This also sets their invite status to `REMOVED`.
This endpoint requires the user to be a member of the project with the role `OWNER`.
## Parameters
- connection (Ory.Connection): Connection to server
- project_id (String.t): Project ID The project's ID.
- member_id (String.t): Member ID
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec remove_project_member(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.GenericError.t} | {:error, Tesla.Env.t}
def remove_project_member(connection, project_id, member_id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/projects/#{project_id}/members/#{member_id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ 400, %Ory.Model.GenericError{}},
{ 401, %Ory.Model.GenericError{}},
{ 406, %Ory.Model.GenericError{}},
{ 500, %Ory.Model.GenericError{}}
])
end
@doc """
Revoke an OAuth2 Access or Refresh Token
Revoking a token (both access and refresh) means that the tokens will be invalid. A revoked access token can no longer be used to make access requests, and a revoked refresh token can no longer be used to refresh an access token. Revoking a refresh token also invalidates the access token that was created with it. A token may only be revoked by the client the token was generated for.
## Parameters
- connection (Ory.Connection): Connection to server
- token (String.t):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec revoke_o_auth2_token(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.OAuth2ApiError.t} | {:error, Tesla.Env.t}
def revoke_o_auth2_token(connection, token, _opts \\ []) do
%{}
|> method(:post)
|> url("/oauth2/revoke")
|> add_param(:form, :token, token)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, false},
{ :default, %Ory.Model.OAuth2ApiError{}}
])
end
@doc """
Calling this endpoint invalidates the specified session. The current session cannot be revoked. Session data are not deleted.
This endpoint is useful for: To forcefully logout the current user from another device or session
## Parameters
- connection (Ory.Connection): Connection to server
- id (String.t): ID is the session's ID.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec revoke_session(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:error, Tesla.Env.t}
def revoke_session(connection, id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/sessions/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ 400, %Ory.Model.JsonError{}},
{ 401, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Calling this endpoint invalidates all except the current session that belong to the logged-in user. Session data are not deleted.
This endpoint is useful for: To forcefully logout the current user from all other devices and sessions
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :x_session_token (String.t): Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`.
- :cookie (String.t): Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored.
## Returns
{:ok, Ory.Model.RevokedSessions.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec revoke_sessions(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.RevokedSessions.t} | {:error, Tesla.Env.t}
def revoke_sessions(connection, opts \\ []) do
optional_params = %{
:"X-Session-Token" => :headers,
:Cookie => :headers
}
%{}
|> method(:delete)
|> url("/sessions")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.RevokedSessions{}},
{ 400, %Ory.Model.JsonError{}},
{ 401, %Ory.Model.JsonError{}},
{ 404, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Submit a Login Flow
:::info This endpoint is EXPERIMENTAL and subject to potential breaking changes in the future. ::: Use this endpoint to complete a login flow. This endpoint behaves differently for API and browser flows. API flows expect `application/json` to be sent in the body and responds with HTTP 200 and a application/json body with the session token on success; HTTP 410 if the original flow expired with the appropriate error messages set and optionally a `use_flow_id` parameter in the body; HTTP 400 on form validation errors. Browser flows expect a Content-Type of `application/x-www-form-urlencoded` or `application/json` to be sent in the body and respond with a HTTP 303 redirect to the post/after login URL or the `return_to` value if it was set and if the login succeeded; a HTTP 303 redirect to the login UI URL with the flow ID containing the validation errors otherwise. Browser flows with an accept header of `application/json` will not redirect but instead respond with HTTP 200 and a application/json body with the signed in identity and a `Set-Cookie` header on success; HTTP 303 redirect to a fresh login flow if the original flow expired with the appropriate error messages set; HTTP 400 on form validation errors. If this endpoint is called with `Accept: application/json` in the header, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `security_identity_mismatch`: The requested `?return_to` address is not allowed to be used. Adjust this in the configuration! `browser_location_change_required`: Usually sent when an AJAX request indicates that the browser needs to open a specific URL. Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
## Parameters
- connection (Ory.Connection): Connection to server
- flow (String.t): The Login Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/login?flow=abcde`).
- submit_self_service_login_flow_body (SubmitSelfServiceLoginFlowBody):
- opts (KeywordList): [optional] Optional parameters
- :x_session_token (String.t): The Session Token of the Identity performing the settings flow.
- :cookie (String.t): HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected.
## Returns
{:ok, Ory.Model.SuccessfulSelfServiceLoginWithoutBrowser.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec submit_self_service_login_flow(Tesla.Env.client, String.t, Ory.Model.SubmitSelfServiceLoginFlowBody.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceBrowserLocationChangeRequiredError.t} | {:ok, Ory.Model.SelfServiceLoginFlow.t} | {:ok, Ory.Model.SuccessfulSelfServiceLoginWithoutBrowser.t} | {:error, Tesla.Env.t}
def submit_self_service_login_flow(connection, flow, submit_self_service_login_flow_body, opts \\ []) do
optional_params = %{
:"X-Session-Token" => :headers,
:Cookie => :headers
}
%{}
|> method(:post)
|> url("/self-service/login")
|> add_param(:query, :flow, flow)
|> add_param(:body, :body, submit_self_service_login_flow_body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SuccessfulSelfServiceLoginWithoutBrowser{}},
{ 303, false},
{ 400, %Ory.Model.SelfServiceLoginFlow{}},
{ 410, %Ory.Model.JsonError{}},
{ 422, %Ory.Model.SelfServiceBrowserLocationChangeRequiredError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Complete Self-Service Logout
This endpoint logs out an identity in a self-service manner. If the `Accept` HTTP header is not set to `application/json`, the browser will be redirected (HTTP 303 See Other) to the `return_to` parameter of the initial request or fall back to `urls.default_return_to`. If the `Accept` HTTP header is set to `application/json`, a 204 No Content response will be sent on successful logout instead. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). For API clients you can call the `/self-service/logout/api` URL directly with the Ory Session Token. More information can be found at [Ory Kratos User Logout Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-logout).
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :token (String.t): A Valid Logout Token If you do not have a logout token because you only have a session cookie, call `/self-service/logout/browser` to generate a URL for this endpoint.
- :return_to (String.t): The URL to return to after the logout was completed.
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec submit_self_service_logout_flow(Tesla.Env.client, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:error, Tesla.Env.t}
def submit_self_service_logout_flow(connection, opts \\ []) do
optional_params = %{
:token => :query,
:return_to => :query
}
%{}
|> method(:get)
|> url("/self-service/logout")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ 303, false},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Perform Logout for APIs, Services, Apps, ...
Use this endpoint to log out an identity using an Ory Session Token. If the Ory Session Token was successfully revoked, the server returns a 204 No Content response. A 204 No Content response is also sent when the Ory Session Token has been revoked already before. If the Ory Session Token is malformed or does not exist a 403 Forbidden response will be returned. This endpoint does not remove any HTTP Cookies - use the Browser-Based Self-Service Logout Flow instead.
## Parameters
- connection (Ory.Connection): Connection to server
- submit_self_service_logout_flow_without_browser_body (SubmitSelfServiceLogoutFlowWithoutBrowserBody):
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, nil} on success
{:error, Tesla.Env.t} on failure
"""
@spec submit_self_service_logout_flow_without_browser(Tesla.Env.client, Ory.Model.SubmitSelfServiceLogoutFlowWithoutBrowserBody.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:error, Tesla.Env.t}
def submit_self_service_logout_flow_without_browser(connection, submit_self_service_logout_flow_without_browser_body, _opts \\ []) do
%{}
|> method(:delete)
|> url("/self-service/logout/api")
|> add_param(:body, :body, submit_self_service_logout_flow_without_browser_body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 204, false},
{ 400, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Complete Recovery Flow
Use this endpoint to complete a recovery flow. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent and works with API- and Browser-initiated flows. For API clients and Browser clients with HTTP Header `Accept: application/json` it either returns a HTTP 200 OK when the form is valid and HTTP 400 OK when the form is invalid. and a HTTP 303 See Other redirect with a fresh recovery flow if the flow was otherwise invalid (e.g. expired). For Browser clients without HTTP Header `Accept` or with `Accept: text/*` it returns a HTTP 303 See Other redirect to the Recovery UI URL with the Recovery Flow ID appended. `sent_email` is the success state after `choose_method` for the `link` method and allows the user to request another recovery email. It works for both API and Browser-initiated flows and returns the same responses as the flow in `choose_method` state. `passed_challenge` expects a `token` to be sent in the URL query and given the nature of the flow (\"sending a recovery link\") does not have any API capabilities. The server responds with a HTTP 303 See Other redirect either to the Settings UI URL (if the link was valid) and instructs the user to update their password, or a redirect to the Recover UI URL with a new Recovery Flow ID which contains an error message that the recovery link was invalid. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery).
## Parameters
- connection (Ory.Connection): Connection to server
- flow (String.t): The Recovery Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/recovery?flow=abcde`).
- submit_self_service_recovery_flow_body (SubmitSelfServiceRecoveryFlowBody):
- opts (KeywordList): [optional] Optional parameters
- :token (String.t): Recovery Token The recovery token which completes the recovery request. If the token is invalid (e.g. expired) an error will be shown to the end-user. This parameter is usually set in a link and not used by any direct API call.
- :cookie (String.t): HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected.
## Returns
{:ok, Ory.Model.SelfServiceRecoveryFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec submit_self_service_recovery_flow(Tesla.Env.client, String.t, Ory.Model.SubmitSelfServiceRecoveryFlowBody.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceRecoveryFlow.t} | {:error, Tesla.Env.t}
def submit_self_service_recovery_flow(connection, flow, submit_self_service_recovery_flow_body, opts \\ []) do
optional_params = %{
:token => :query,
:Cookie => :headers
}
%{}
|> method(:post)
|> url("/self-service/recovery")
|> add_param(:query, :flow, flow)
|> add_param(:body, :body, submit_self_service_recovery_flow_body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceRecoveryFlow{}},
{ 303, false},
{ 400, %Ory.Model.SelfServiceRecoveryFlow{}},
{ 410, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Submit a Registration Flow
Use this endpoint to complete a registration flow by sending an identity's traits and password. This endpoint behaves differently for API and browser flows. API flows expect `application/json` to be sent in the body and respond with HTTP 200 and a application/json body with the created identity success - if the session hook is configured the `session` and `session_token` will also be included; HTTP 410 if the original flow expired with the appropriate error messages set and optionally a `use_flow_id` parameter in the body; HTTP 400 on form validation errors. Browser flows expect a Content-Type of `application/x-www-form-urlencoded` or `application/json` to be sent in the body and respond with a HTTP 303 redirect to the post/after registration URL or the `return_to` value if it was set and if the registration succeeded; a HTTP 303 redirect to the registration UI URL with the flow ID containing the validation errors otherwise. Browser flows with an accept header of `application/json` will not redirect but instead respond with HTTP 200 and a application/json body with the signed in identity and a `Set-Cookie` header on success; HTTP 303 redirect to a fresh login flow if the original flow expired with the appropriate error messages set; HTTP 400 on form validation errors. If this endpoint is called with `Accept: application/json` in the header, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `security_identity_mismatch`: The requested `?return_to` address is not allowed to be used. Adjust this in the configuration! `browser_location_change_required`: Usually sent when an AJAX request indicates that the browser needs to open a specific URL. Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
## Parameters
- connection (Ory.Connection): Connection to server
- flow (String.t): The Registration Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/registration?flow=abcde`).
- submit_self_service_registration_flow_body (SubmitSelfServiceRegistrationFlowBody):
- opts (KeywordList): [optional] Optional parameters
- :cookie (String.t): HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected.
## Returns
{:ok, Ory.Model.SuccessfulSelfServiceRegistrationWithoutBrowser.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec submit_self_service_registration_flow(Tesla.Env.client, String.t, Ory.Model.SubmitSelfServiceRegistrationFlowBody.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceBrowserLocationChangeRequiredError.t} | {:ok, Ory.Model.SelfServiceRegistrationFlow.t} | {:ok, Ory.Model.SuccessfulSelfServiceRegistrationWithoutBrowser.t} | {:error, Tesla.Env.t}
def submit_self_service_registration_flow(connection, flow, submit_self_service_registration_flow_body, opts \\ []) do
optional_params = %{
:Cookie => :headers
}
%{}
|> method(:post)
|> url("/self-service/registration")
|> add_param(:query, :flow, flow)
|> add_param(:body, :body, submit_self_service_registration_flow_body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SuccessfulSelfServiceRegistrationWithoutBrowser{}},
{ 303, false},
{ 400, %Ory.Model.SelfServiceRegistrationFlow{}},
{ 410, %Ory.Model.JsonError{}},
{ 422, %Ory.Model.SelfServiceBrowserLocationChangeRequiredError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Complete Settings Flow
Use this endpoint to complete a settings flow by sending an identity's updated password. This endpoint behaves differently for API and browser flows. API-initiated flows expect `application/json` to be sent in the body and respond with HTTP 200 and an application/json body with the session token on success; HTTP 303 redirect to a fresh settings flow if the original flow expired with the appropriate error messages set; HTTP 400 on form validation errors. HTTP 401 when the endpoint is called without a valid session token. HTTP 403 when `selfservice.flows.settings.privileged_session_max_age` was reached or the session's AAL is too low. Implies that the user needs to re-authenticate. Browser flows without HTTP Header `Accept` or with `Accept: text/*` respond with a HTTP 303 redirect to the post/after settings URL or the `return_to` value if it was set and if the flow succeeded; a HTTP 303 redirect to the Settings UI URL with the flow ID containing the validation errors otherwise. a HTTP 303 redirect to the login endpoint when `selfservice.flows.settings.privileged_session_max_age` was reached or the session's AAL is too low. Browser flows with HTTP Header `Accept: application/json` respond with HTTP 200 and a application/json body with the signed in identity and a `Set-Cookie` header on success; HTTP 303 redirect to a fresh login flow if the original flow expired with the appropriate error messages set; HTTP 401 when the endpoint is called without a valid session cookie. HTTP 403 when the page is accessed without a session cookie or the session's AAL is too low. HTTP 400 on form validation errors. Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator Assurance Level (AAL) than is possible for the identity. This can happen if the identity has password + webauthn credentials (which would result in AAL2) but the session has only AAL1. If this error occurs, ask the user to sign in with the second factor (happens automatically for server-side browser flows) or change the configuration. If this endpoint is called with a `Accept: application/json` HTTP header, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `session_refresh_required`: The identity requested to change something that needs a privileged session. Redirect the identity to the login init endpoint with query parameters `?refresh=true&return_to=<the-current-browser-url>`, or initiate a refresh login flow otherwise. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `session_inactive`: No Ory Session was found - sign in a user first. `security_identity_mismatch`: The flow was interrupted with `session_refresh_required` but apparently some other identity logged in instead. `security_identity_mismatch`: The requested `?return_to` address is not allowed to be used. Adjust this in the configuration! `browser_location_change_required`: Usually sent when an AJAX request indicates that the browser needs to open a specific URL. Most likely used in Social Sign In flows. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
## Parameters
- connection (Ory.Connection): Connection to server
- flow (String.t): The Settings Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/settings?flow=abcde`).
- submit_self_service_settings_flow_body (SubmitSelfServiceSettingsFlowBody):
- opts (KeywordList): [optional] Optional parameters
- :x_session_token (String.t): The Session Token of the Identity performing the settings flow.
- :cookie (String.t): HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected.
## Returns
{:ok, Ory.Model.SelfServiceSettingsFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec submit_self_service_settings_flow(Tesla.Env.client, String.t, Ory.Model.SubmitSelfServiceSettingsFlowBody.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceBrowserLocationChangeRequiredError.t} | {:ok, Ory.Model.SelfServiceSettingsFlow.t} | {:error, Tesla.Env.t}
def submit_self_service_settings_flow(connection, flow, submit_self_service_settings_flow_body, opts \\ []) do
optional_params = %{
:"X-Session-Token" => :headers,
:Cookie => :headers
}
%{}
|> method(:post)
|> url("/self-service/settings")
|> add_param(:query, :flow, flow)
|> add_param(:body, :body, submit_self_service_settings_flow_body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceSettingsFlow{}},
{ 303, false},
{ 400, %Ory.Model.SelfServiceSettingsFlow{}},
{ 401, %Ory.Model.JsonError{}},
{ 403, %Ory.Model.JsonError{}},
{ 410, %Ory.Model.JsonError{}},
{ 422, %Ory.Model.SelfServiceBrowserLocationChangeRequiredError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Complete Verification Flow
Use this endpoint to complete a verification flow. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent and works with API- and Browser-initiated flows. For API clients and Browser clients with HTTP Header `Accept: application/json` it either returns a HTTP 200 OK when the form is valid and HTTP 400 OK when the form is invalid and a HTTP 303 See Other redirect with a fresh verification flow if the flow was otherwise invalid (e.g. expired). For Browser clients without HTTP Header `Accept` or with `Accept: text/*` it returns a HTTP 303 See Other redirect to the Verification UI URL with the Verification Flow ID appended. `sent_email` is the success state after `choose_method` when using the `link` method and allows the user to request another verification email. It works for both API and Browser-initiated flows and returns the same responses as the flow in `choose_method` state. `passed_challenge` expects a `token` to be sent in the URL query and given the nature of the flow (\"sending a verification link\") does not have any API capabilities. The server responds with a HTTP 303 See Other redirect either to the Settings UI URL (if the link was valid) and instructs the user to update their password, or a redirect to the Verification UI URL with a new Verification Flow ID which contains an error message that the verification link was invalid. More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/selfservice/flows/verify-email-account-activation).
## Parameters
- connection (Ory.Connection): Connection to server
- flow (String.t): The Verification Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/verification?flow=abcde`).
- submit_self_service_verification_flow_body (SubmitSelfServiceVerificationFlowBody):
- opts (KeywordList): [optional] Optional parameters
- :token (String.t): Verification Token The verification token which completes the verification request. If the token is invalid (e.g. expired) an error will be shown to the end-user. This parameter is usually set in a link and not used by any direct API call.
- :cookie (String.t): HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected.
## Returns
{:ok, Ory.Model.SelfServiceVerificationFlow.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec submit_self_service_verification_flow(Tesla.Env.client, String.t, Ory.Model.SubmitSelfServiceVerificationFlowBody.t, keyword()) :: {:ok, nil} | {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.SelfServiceVerificationFlow.t} | {:error, Tesla.Env.t}
def submit_self_service_verification_flow(connection, flow, submit_self_service_verification_flow_body, opts \\ []) do
optional_params = %{
:token => :query,
:Cookie => :headers
}
%{}
|> method(:post)
|> url("/self-service/verification")
|> add_param(:query, :flow, flow)
|> add_param(:body, :body, submit_self_service_verification_flow_body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SelfServiceVerificationFlow{}},
{ 303, false},
{ 400, %Ory.Model.SelfServiceVerificationFlow{}},
{ 410, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Check Who the Current HTTP Session Belongs To
Uses the HTTP Headers in the GET request to determine (e.g. by using checking the cookies) who is authenticated. Returns a session object in the body or 401 if the credentials are invalid or no credentials were sent. Additionally when the request it successful it adds the user ID to the 'X-Kratos-Authenticated-Identity-Id' header in the response. If you call this endpoint from a server-side application, you must forward the HTTP Cookie Header to this endpoint: ```js pseudo-code example router.get('/protected-endpoint', async function (req, res) { const session = await client.toSession(undefined, req.header('cookie')) console.log(session) }) ``` When calling this endpoint from a non-browser application (e.g. mobile app) you must include the session token: ```js pseudo-code example ... const session = await client.toSession(\"the-session-token\") console.log(session) ``` Depending on your configuration this endpoint might return a 403 status code if the session has a lower Authenticator Assurance Level (AAL) than is possible for the identity. This can happen if the identity has password + webauthn credentials (which would result in AAL2) but the session has only AAL1. If this error occurs, ask the user to sign in with the second factor or change the configuration. This endpoint is useful for: AJAX calls. Remember to send credentials and set up CORS correctly! Reverse proxies and API Gateways Server-side calls - use the `X-Session-Token` header! This endpoint authenticates users by checking if the `Cookie` HTTP header was set containing an Ory Kratos Session Cookie; if the `Authorization: bearer <ory-session-token>` HTTP header was set with a valid Ory Kratos Session Token; if the `X-Session-Token` HTTP header was set with a valid Ory Kratos Session Token. If none of these headers are set or the cooke or token are invalid, the endpoint returns a HTTP 401 status code. As explained above, this request may fail due to several reasons. The `error.id` can be one of: `session_inactive`: No active session was found in the request (e.g. no Ory Session Cookie / Ory Session Token). `session_aal2_required`: An active session was found but it does not fulfil the Authenticator Assurance Level, implying that the session must (e.g.) authenticate the second factor.
## Parameters
- connection (Ory.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :x_session_token (String.t): Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`.
- :cookie (String.t): Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored.
## Returns
{:ok, Ory.Model.Session.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec to_session(Tesla.Env.client, keyword()) :: {:ok, Ory.Model.JsonError.t} | {:ok, Ory.Model.Session.t} | {:error, Tesla.Env.t}
def to_session(connection, opts \\ []) do
optional_params = %{
:"X-Session-Token" => :headers,
:Cookie => :headers
}
%{}
|> method(:get)
|> url("/sessions/whoami")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.Session{}},
{ 401, %Ory.Model.JsonError{}},
{ 403, %Ory.Model.JsonError{}},
{ 500, %Ory.Model.JsonError{}}
])
end
@doc """
Update an Ory Cloud Project Configuration
This endpoints allows you to update the Ory Cloud Project configuration for individual services (identity, permission, ...). The configuration is fully compatible with the open source projects for the respective services (e.g. Ory Kratos for Identity, Ory Keto for Permissions). This endpoint expects the `version` key to be set in the payload. If it is unset, it will try to import the config as if it is from the most recent version. If you have an older version of a configuration, you should set the version key in the payload! While this endpoint is able to process all configuration items related to features (e.g. password reset), it does not support operational configuration items (e.g. port, tracing, logging) otherwise available in the open source. For configuration items that can not be translated to Ory Cloud, this endpoint will return a list of warnings to help you understand which parts of your config could not be processed. Be aware that updating any service's configuration will completely override your current configuration for that service!
## Parameters
- connection (Ory.Connection): Connection to server
- project_id (String.t): Project ID The project's ID.
- opts (KeywordList): [optional] Optional parameters
- :body (UpdateProject):
## Returns
{:ok, Ory.Model.SuccessfulProjectUpdate.t} on success
{:error, Tesla.Env.t} on failure
"""
@spec update_project(Tesla.Env.client, String.t, keyword()) :: {:ok, Ory.Model.GenericError.t} | {:ok, Ory.Model.SuccessfulProjectUpdate.t} | {:error, Tesla.Env.t}
def update_project(connection, project_id, opts \\ []) do
optional_params = %{
:body => :body
}
%{}
|> method(:put)
|> url("/projects/#{project_id}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{ 200, %Ory.Model.SuccessfulProjectUpdate{}},
{ 400, %Ory.Model.GenericError{}},
{ 401, %Ory.Model.GenericError{}},
{ 403, %Ory.Model.GenericError{}},
{ 404, %Ory.Model.GenericError{}},
{ :default, %Ory.Model.GenericError{}}
])
end
end