Hello
@great-crayon-86888
Firstly, for native applications, you must use the API flows which don’t set any cookies. The response contains all data required to render the UI. On successful login, Ory issues a session token that can be used to authenticate subsequent requests to Ory.
To generate the token using Ory Hydra after the user is authenticated using Kratos, you need to follow these steps:
1. The login endpoint authenticates the user as usual, for example by username & password, session cookie or other means. Upon successful authentication, the login endpoint redirects the user back to Ory Hydra.
2. Next, Ory Hydra needs the user’s consent. It redirects the user agent to the consent endpoint where the user is asked something like “Do you want to grant MyAnalyticsApp read access to your todo lists? [Yes][no]“. Once the user gives consent by clicking Yes, the consent endpoint redirects back to Ory Hydra.
3. Hydra validates the request and issues the access, refresh, and ID tokens. You can validate the access tokens which are sent to your API directly at Ory Hydra, or use an Identity & Access Proxy like Ory Oathkeeper to do it for you.
Regarding the
login_challenge
, it is an optional Hydra login challenge. If present, Kratos will cooperate with Ory Hydra to act as an OAuth2 identity provider. The value for this parameter comes from
login_challenge
URL Query parameter sent to your application (e.g.
/login?login_challenge=abcde
).
We dont have specific instructions for the .NET SDK, any contributions there are welcomed!