Closed meroo36 closed 11 months ago
My guess is the sessionToKeepAlive variable is beeing nil for the second time.
var sessionToKeepAlive: Any? // if we do not keep the session alive, it will get closed immediately while showing the dialog
completionHandler = { (url: URL?, err: Error?) in
self.completionHandler = nil
if #available(iOS 12, *) {
(sessionToKeepAlive as! ASWebAuthenticationSession).cancel() // Error Happens this line 29 in SwiftFlutterWebAuth2Plugin
} else if #available(iOS 11, *) {
(sessionToKeepAlive as! SFAuthenticationSession).cancel()
}
sessionToKeepAlive = nil
EDIT: after commenting out the last line in the code block => "sessionToKeepAlive = nil". The issue seems to be gone.
@ThexXTURBOXx can you maybe give an hint why do we have to set it to nil and what would gone wrong if we dont set it to nil.
I could fix the issue by wrapping the oauth2 call with a timer. I guess you need to wait a little untill the app is on the foreground succesfully.
Timer(Duration(milliseconds: lazyLoginDelayTime), () async {
List<String> scopes = ["*****", "******"];
await account.createOAuth2Session(
provider: "*******", scopes: scopes);
await ref.read(authProvider.notifier).login();
});
Closing for now.
Same issue, is it fixed in the 3.0.0?
I think I have changed nothing in the Apple-specific implementations. Also, I don't have any Apple hardware, so I cannot properly debug these issues. PRs are welcome, though.
Here is a stack trace, perhaps it will help:
Thanks for the stacktrace. However, it sadly does not contain any additional information.
I have just released version 3.0.0-alpha.4
.
It could contain a valid fix, but I don't have any Apple hardware to test this. So, please report back in case you tried it!
Also, if you are upgrading from 2.x
, note the migration guide
Will close for now until further feedback on 3.x
Describe the bug
App crashes after second time I initialize oauth2 flow in IOS.
To Reproduce
Steps to reproduce the behavior:
Device (please complete the following information!)
flutter_web_auth_2
version: 2.2.1