diff --git a/src/clj/auto_ap/routes/yodlee2.clj b/src/clj/auto_ap/routes/yodlee2.clj index 63cee02e..3d090f3e 100644 --- a/src/clj/auto_ap/routes/yodlee2.clj +++ b/src/clj/auto_ap/routes/yodlee2.clj @@ -13,7 +13,14 @@ (context "/yodlee2" [] (GET "/fastlink" {:keys [query-params identity] :as request} (assert-admin identity) - (let [token (yodlee/get-access-token (get query-params "client"))] + + (let [token (if-let [client-id (get query-params "client-id")] + (-> client-id + Long/parseLong + d-clients/get-by-id + :client/code + (yodlee/get-access-token)) + (yodlee/get-access-token (get query-params "client")))] {:status 200 :headers {"Content-Type" "application/edn"} :body (pr-str {:token token diff --git a/src/cljs/auto_ap/views/pages/admin/yodlee2/form.cljs b/src/cljs/auto_ap/views/pages/admin/yodlee2/form.cljs index 2971d06c..0af47b07 100644 --- a/src/cljs/auto_ap/views/pages/admin/yodlee2/form.cljs +++ b/src/cljs/auto_ap/views/pages/admin/yodlee2/form.cljs @@ -9,13 +9,13 @@ :component-did-mount (fn [this] (let [{:keys [authentication provider-account-id]} (r/props this)] (try + (println (js/parseInt provider-account-id) (:url authentication) (:token authentication)) (.open (.-fastlink js/window) #js {"fastLinkURL" (:url authentication) "accessToken" (:token authentication) - "params" #js { "configName" "Aggregation" + "params" #js {"configName" "Aggregation" "providerAccountId" (js/parseInt provider-account-id) "flow" "edit"}} - "fa-modal-spot") (catch js/Error e (println e))))) @@ -27,7 +27,7 @@ (re-frame/reg-event-fx ::reauthenticate-start - (fn [_ [_ _ provider-account-id authentication]] + (fn [_ [_ provider-account-id authentication]] {:dispatch [::modal/modal-requested {:title (str "Reauthenticate " provider-account-id) :body [form {:provider-account-id provider-account-id :authentication authentication}] diff --git a/src/cljs/auto_ap/views/pages/admin/yodlee2/table.cljs b/src/cljs/auto_ap/views/pages/admin/yodlee2/table.cljs index d6cdf6d8..31d3be3f 100644 --- a/src/cljs/auto_ap/views/pages/admin/yodlee2/table.cljs +++ b/src/cljs/auto_ap/views/pages/admin/yodlee2/table.cljs @@ -44,10 +44,10 @@ {:http {:token user :method :get :headers {"Content-Type" "application/edn"} - :uri (str "/api/yodlee2/fastlink?client=" client-id) + :uri (str "/api/yodlee2/fastlink?client-id=" client-id) :owns-state {:multi ::request-login-form :which (:id provider-account)} - :on-success [::form/reauthenticate-start client-id provider-account]}})) + :on-success [::form/reauthenticate-start provider-account]}})) (re-frame/reg-event-fx ::delete-provider-account