gray-machine-46287
08/10/2022, 1:35 PMid_token
, we send it to our internal authentication service
3. This service will start an API Kratos flow, and then submit the id_token
to Kratos (using https://github.com/ory/kratos/pull/2346 once is ready)
4. Kratos identifies the user or creates it, and returns a session token, which our service returns to the mobile app.
Now the mobile app has a Kratos session token, but our apps require Hydra oauth2 tokens to authenticate. So then:
1. The mobile app starts the Hydra oauth2 using its client ID in an in-app browser (and we attach the Kratos session token)
2. It gets redirected to our login form, with the Kratos session token as query param.
3. Our service checks the Kratos session token validity, and accepts the login.
4. Hydra redirects to the redirect URI with the auth code.
The issues we see is that:
β’ The Hydra flow will require to open an in-app browser on mobile, which opens and closes without user interactions, which is less than ideal. Is there any alternative?
β’ I'm unsure that a web social sign-in flow (with Kratos) using the same social provider as on mobile, would actually connect the same user or create a new one. If the same social provider has 2 different clients, will they be represented by 2 different credentials identifiers in Kratos, or will they be the same?
Any thoughts about this? π
Thanks a lot for your awesome work and for your help πͺ πmagnificent-energy-493
The Hydra flow will require to open an in-app browser on mobile, which opens and closes without user interactions, which is less than ideal. Is there any alternative?IMO the best alternative would be to just use the Kratos flows and forgo the Hydra OAuth2 tokens - then there is no browser needed on mobile. I dont think there is a good alternative, a lot of work was done in Kratos to make this smooth flow possible. Can you share a bit of background why you need OAuth2 tokens, maybe I am missing something? I donβt have too much experience with mobile clients, forgive me π
Iβm unsure that a web social sign-in flow (with Kratos) using the same social provider as on mobile, would actually connect the same user or create a new one. If the same social provider has 2 different clients, will they be represented by 2 different credentials identifiers in Kratos, or will they be the same?When using the login flow for browsers or API clients this will both be the same identity in Kratos (once the aforementioned support for OIDC in API-based flows is implemented).
gray-machine-46287
08/17/2022, 4:02 PMCan you share a bit of background why you need OAuth2 tokensWe are planning to pass some information in the OAuth2 tokens, we will need them. The Kratos token is too opaque for our usage here.
When using the login flow for browsers or API clients this will both be the same identity in Kratos (once the aforementioned support for OIDC in API-based flows is implemented).Thanks for the clarification! That helps me π There is a fair chance we won't go with a native mobile experience in our MVP, and stay browser-based to avoid these complexities for now. Maybe I'll circle back in a few months to ask more questions or give some feedback π
magnificent-energy-493
We are planning to pass some information in the OAuth2 tokens, we will need them. The Kratos token is too opaque for our usage here.What do you mean by opaque? You can use Metadata for data that should not be visible to the end-user, although its best practice to keep your business logic related data close to where you need it (i.e. in your application rather than the identity service). The cookie is protected by highest standards β’ `secure`: The cookie is only sent over HTTPS connection to protect against man-in-the-middle attacks. β’ `httpOnly`: The cookie is not available to JavaScript code to protect against XSS. β’ `sameSite=Strict`: The cookie can only be requested from the same origin to protect against CSRF attacks.
gray-machine-46287
09/01/2022, 12:36 PMmagnificent-energy-493