From 52b4ee62878212e95635df9b78c907f07340f3e1 Mon Sep 17 00:00:00 2001 From: Vinicius Brasil Date: Mon, 26 Sep 2022 16:21:19 -0300 Subject: [PATCH] fixup! Refresh Google Analytics token before import (#2254) (#2273) --- lib/plausible/google/api.ex | 2 +- lib/plausible_web/controllers/auth_controller.ex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plausible/google/api.ex b/lib/plausible/google/api.ex index 7878bc53f..f0c91ccfb 100644 --- a/lib/plausible/google/api.ex +++ b/lib/plausible/google/api.ex @@ -239,7 +239,7 @@ defmodule Plausible.Google.Api do defp do_refresh_token(refresh_token) do case HTTP.refresh_auth_token(refresh_token) do - {:ok, %{"access_token" => new_access_token, "expires_at" => expires_in}} -> + {:ok, %{"access_token" => new_access_token, "expires_in" => expires_in}} -> expires_at = NaiveDateTime.add(NaiveDateTime.utc_now(), expires_in) {:ok, {new_access_token, expires_at}} diff --git a/lib/plausible_web/controllers/auth_controller.ex b/lib/plausible_web/controllers/auth_controller.ex index 0dd6bfa42..c6e55b8af 100644 --- a/lib/plausible_web/controllers/auth_controller.ex +++ b/lib/plausible_web/controllers/auth_controller.ex @@ -568,7 +568,7 @@ defmodule PlausibleWeb.AuthController do email: id["email"], refresh_token: res["refresh_token"], access_token: res["access_token"], - expires_at: expires_at, + expires: expires_at, user_id: conn.assigns[:current_user].id, site_id: site_id })