# How to implement PKCE for flutter web?

**URL:** <https://community.auth0.com/t/how-to-implement-pkce-for-flutter-web/131510>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [April 8, 2024, 12:05pm UTC](https://community.auth0.com/t/how-to-implement-pkce-for-flutter-web/131510 "2024-04-08T12:05:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.pang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/michael.pang/32/56249_2.png) [@michael.pang](https://community.auth0.com/u/michael.pang)\
**Post date:** [April 8, 2024, 12:05pm UTC](https://community.auth0.com/t/how-to-implement-pkce-for-flutter-web/131510/1 "2024-04-08T12:05:06Z")

</div>

From the example provided by auth0, after user call auth0Web.loginWithRedirect(  
redirectUrl: ‘[https://myRedirect.com](https://myRedirect.com)’,  
);

The result is void, then how can we exchange tokens with authorization code?  
From `auth0-spa-js` we can know that FE need call handleRedirectCallback, but auth0\_web for flutter don’t have this api, shall we call it by javascript manually?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [April 8, 2024, 8:55pm UTC](https://community.auth0.com/t/how-to-implement-pkce-for-flutter-web/131510/3 "2024-04-08T20:55:46Z")

</div>

Hey there @michael.pang welcome to the community!

> [@michael.pang](#):
>
> The result is void, then how can we exchange tokens with authorization code?

Can you help me understand what you mean here? Upon successful authentication with `loginWithRedirect` users should be redirected back to your to your application. There isn’t a direct equivalent to `handleRedirectCallback` but maybe the [onLoad](https://pub.dev/documentation/auth0_flutter/latest/auth0_flutter_web/Auth0Web/onLoad.html) method is what you’re looking for.

Here’s how it is utilized in the sample app:

> <https://github.com/auth0-samples/auth0-flutter-samples/blob/752d1a27ec2e632a83089e73dc409ac617e1515e/sample/lib/example_app.dart#L34>

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [April 22, 2024, 8:56pm UTC](https://community.auth0.com/t/how-to-implement-pkce-for-flutter-web/131510/4 "2024-04-22T20:56:14Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
