Support for OAuth 2.0 Token Exchange (RFC 8693)
Hi, before coming to my specific use case, I do have a related general question: Is there or will there be support for the quite fresh RFC 8693 specification within AppAuth libraries? Basically this is specifying a new grant type for token endpoint which allows to exchange some subject-specific token with a complete (new) set of OAuth/OpenID tokens.
The OAuth 2.0 Token Exchange draft is already supported somewhat by a set of the larger OpenID Provider implementations, e. g. within Keycloak, within oidc-provider, within Auth0.com or soon within Connect2Id.
For my specific background: I'm currently working on an app project which is supposed to provide two different flows for finally signing in to an OpenID Connect based Authorization Server, depending on (1) whether an account already exists at the AS, or (2) when there is a multistep "account-creation-plus-purchase-flow" in between. Basically the first case is a regular Auth Code + PKCE flow for which I'd like to make use of the great AppAuth library. However, case (2) is a bit tricky in the sense that due to the more-than-pure-login flow there is no upfront known step on which the AS can/should trigger the redirect to custom scheme uri for switching back to app context. Additionally the webapp which is used within browser tab to handle the registration, purchase and configuration flow is in itself an OpenID client to the same AS, hence this is not any Authorization Code flow at all anymore from the viewpoint of the native Android app.
For (2) I'm now aiming to provide a custom user experience which basically looks like this:
- The native app generates a random challenge
app_verifierand a corresponding S256 hash of it (app_challenge) => obviously borrowed from PKCE - From native app, a browser or a Chrome Custom Tab is opened with
app_challengebeing part or URL query parameters - The SPA web app in browser starts its own Auth Code w/ PKCE flow towards the AS, adding the
app_challengeas an extra param to the/authorizationendpoint - The AS performs regular Authorization Code Flow but keeps the
app_challengeas part of the state - After successful login and
/tokenexchange, the initially providedapp_challengeis also persisted as an attribute of the logged-in account - The end-user performs an arbitrary set of additional actions within his browser session, e. g. purchases some service, extends his profile, ... Finally, he somehow returns to the surrounding app - either via task switcher, via "back arrow" of the Chrome Custom Tab, or via any other possible way
- Now, once the app is pulled to foreground again, it remembers that x minutes ago a web session has been triggered, attributed with the
app_challenge; the app now tries to exchange the yet localapp_verifierat the/tokenendpoint with its own set of tokens, with the server verifying that there had been a login request withS256(app_verifier)not more than x minutes ago.
For me step 7. would be a perfect candidate of new grant type urn:ietf:params:oauth:grant-type:token-exchange, hence it would be great to know whether there will be (or maybe already is) support for the RFC in AppAuth.
There is no support yet for this RFC, we (the AppAuth maintainers) will have to decide if and how to add support consistently across the three platform implementations (Android, iOS, and JS). @WilliamDenniss @tikurahul any thoughts here?
Hi, is there a solution for this "problem"? I would like to use this mode but before starting to change things, I would like to hear your opinion