Major change: Switch to the flutter_web_auth_2 package
We have upgraded our authentication package from the deprecated flutter_web_auth to the new and improved flutter_web_auth_2. This change was necessary as the flutter_web_auth package is no longer actively maintained, and we want to ensure compatibility with the latest Flutter versions.
flutter_web_auth_2 setup guide:
- 
iOS: No additional setup required 
- 
Android: In order to capture the callback URL. You will need to add the following activity to your AndroidManifest.xml file. Replace YOUR_CALLBACK_URL_SCHEME_HEREwith your actual callback URL scheme (io.logto etc.).<manifest> <application> <activity android:name="com.linusu.flutter_web_auth_2.CallbackActivity" android:exported="true"> <intent-filter android:label="flutter_web_auth_2"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="YOUR_CALLBACK_URL_SCHEME_HERE" /> </intent-filter> </activity> </application> </manifest> Remove any android:taskAffinityentries and add setandroid:launchMode="singleTop"to the main activity in the AndroidManifest.xml file.
- 
Web: Create a new endpoint to capture the callback URL and send it back to the application using the postMessageAPI. The endpoint should be the same as theredirectUriparameter in thesignInmethod.<!DOCTYPE html> <title>Authentication complete</title> <p> Authentication is complete. If this does not happen automatically, please close the window. </p> <script> function postAuthenticationMessage() { const message = { "flutter-web-auth-2": window.location.href, }; if (window.opener) { window.opener.postMessage(message, window.location.origin); window.close(); } else if (window.parent && window.parent !== window) { window.parent.postMessage(message, window.location.origin); } else { localStorage.setItem("flutter-web-auth-2", window.location.href); window.close(); } } postAuthenticationMessage(); </script> 
Please check the setup guide in the flutter_web_auth_2 package for more details.
New features
- With the latest flutter_web_auth_2package, this SDK now supports the Web platform. You can use Logto Dart SDK in your Flutter web projects as well. Officially supported platforms are iOS, Android, and Web.
Bug fixes
- Fix the namespace missing issue when building with the latest Gradle version on Android. (#75)
- Fix the issue that the webview is not closing after the user completes the OAuth2 authorization flow on Android. (#60)
- Fix the issue on Android that the sign-in session is not cleared after the user signs out.
Breaking changes
signOut method now requires a redirectUri parameter. For iOS platform, this parameter is useless, but for Android and Web platforms which require an additional end_session request to clean up the sign-in session, this parameter will be used as the post_logout_redirect_uri parameter in the end_session request.
await logtoClient.signOut(redirectUri);This change will not impact the user experience on iOS. However, for Android and Web platforms, when users click the sign-out button, an end_session request will be initiated. This is done by opening a webview using the end_session URL with the post_logout_redirect_uri parameter set to the redirectUri value. After the end_session request is completed, the webview will be closed automatically. As a result, the sign-in session will be cleared.
Other dependencies patch updates
- bump crypto package
- bump jose package
- bump json_annotation package