Created
July 25, 2019 15:41
-
-
Save plateaukao/e978ec4235bd13329743c9b6b70477fa to your computer and use it in GitHub Desktop.
flickr_verifier.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; | |
class _MyHomePageState extends State<MyHomePage> { | |
FlutterWebviewPlugin _flutterWebviewPlugin; | |
@override | |
void initState() { | |
super.initState(); | |
... | |
_flutterWebviewPlugin = FlutterWebviewPlugin()..onUrlChanged.listen((url) { | |
final uri = Uri.parse(url); | |
if (uri.host == "localhost" && uri.queryParameters.containsKey("oauth_verifier")) { | |
final verifier = uri.queryParameters["oauth_verifier"]; | |
_flutterWebviewPlugin.close(); | |
client.requestToken(verifier).then((authClient) { | |
_refreshPhotos(); | |
}); | |
} | |
print(url); | |
}); | |
} | |
_createLoginUI() { | |
return OutlineButton( | |
onPressed: () => client.getRequestTokenUrl().then((url){ | |
//launch(url); | |
_flutterWebviewPlugin.launch(url); | |
}), | |
child: ... | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment