Skip to content

Commit

Permalink
Pass oauth redirect url to quiltt connector url
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-quiltt committed Sep 21, 2023
1 parent 77584ac commit 9a5b6db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.0.0+1"
version: "0.1.0"
sky_engine:
dependency: transitive
description: flutter
Expand Down
17 changes: 4 additions & 13 deletions lib/quiltt_connector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,17 @@ class _WebViewPage {
}
}

_encodeUrl(String url) {
return Uri.encodeComponent(url);
}

Widget build(BuildContext context) {
var oauthRedirectUrl = Uri.encodeComponent(_config.oauthRedirectUrl);
var connectorUrl =
"https://${_config.connectorId}.quiltt.dev/?mode=webview&quiltt_debug=true";
// Plaid might need to encode the redirect url
// dynamic oauthRedirectUrl = _config.oauthRedirectUrl == null
// ? null
// : _encodeUrl(_config.oauthRedirectUrl!);
debugPrint("oauthRedirectUrl: ${_config.oauthRedirectUrl}");
"https://${_config.connectorId}.quiltt.dev/?mode=webview&oauth_redirect_url=$oauthRedirectUrl&quiltt_debug=true";
var javaScript = """
const options = {
source: 'quiltt',
type: 'Options',
token: '${_config.sessionToken}',
connectorId: '${_config.connectorId}',
connectionId: '${_config.connectionId}',
oauthRedirectUrl: '${_config.oauthRedirectUrl}',
};
const compactedOptions = Object.keys(options).reduce((acc, key) => {
if (options[key] !== 'null') {
Expand Down Expand Up @@ -116,15 +107,15 @@ class _WebViewPage {

class Configuration {
String connectorId;
String oauthRedirectUrl;
String? connectionId;
String? sessionToken;
String? oauthRedirectUrl;

Configuration({
required this.connectorId,
required this.oauthRedirectUrl,
this.connectionId,
this.sessionToken,
this.oauthRedirectUrl,
});
}

Expand Down

0 comments on commit 9a5b6db

Please sign in to comment.