openid_client icon indicating copy to clipboard operation
openid_client copied to clipboard

[Question] - Authenticator for authorization code

Open morrowyn opened this issue 1 year ago • 3 comments

Hi,

I'm trying to use your library. The example code uses an Authenticator which uses the implicit flow. However I'm trying to use the authorization code with pkce, but I can't seem to configure the Authenticator for such usage. The documentation is also unclear on this part on how to set it up.

Regards,

morrowyn avatar Jun 30 '23 10:06 morrowyn

have you checked out the flutter example in the example directory?

rbellens avatar Oct 13 '23 13:10 rbellens

Yes, I have, you initiate an openid_client and for every browser Authenticator that needs a Flow, you default to an implicit flow. See https://github.com/appsup-dart/openid_client/blob/c899185b3d61b4774bde604baf59544a7e965bca/lib/openid_client_browser.dart#L39

and https://github.com/appsup-dart/openid_client/blob/master/example/flutter_example/lib/openid_browser.dart

And there is no clear documentation on how to setup a browser client using authorization code with pkce. Maybe I'm missing something, but if you can point out (url or files) where I need to look to set it up, that would be helpful.

morrowyn avatar Oct 15 '23 19:10 morrowyn

The Authenticator class is merely a wrapper around Flow that handles some common use cases, but it is not necessary to use it. It indeed does not handle pkce on browser. Implementing this should be fairly easy by creating a Flow.authorizationCodeWithPKCE and implementing your own authorize function.

Feel free to add this to the Authenticator class and send a pull request.

rbellens avatar Oct 16 '23 09:10 rbellens