From 0331515f376475159416ed487143f30979ff3e53 Mon Sep 17 00:00:00 2001 From: Carter Mintey Date: Fri, 23 Feb 2024 04:47:21 +0000 Subject: [PATCH] only request a mealie token on initial callback --- frontend/nuxt.config.js | 1 + frontend/schemes/DynamicOpenIDConnectScheme.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/nuxt.config.js b/frontend/nuxt.config.js index 73a91bb98f2..cc4f97750d3 100644 --- a/frontend/nuxt.config.js +++ b/frontend/nuxt.config.js @@ -161,6 +161,7 @@ export default { }, oidc: { scheme: "~/schemes/DynamicOpenIDConnectScheme", + resetOnError: true, clientId: "", endpoints: { configuration: "", diff --git a/frontend/schemes/DynamicOpenIDConnectScheme.js b/frontend/schemes/DynamicOpenIDConnectScheme.js index 5fc35f60809..88d4eb4e74b 100644 --- a/frontend/schemes/DynamicOpenIDConnectScheme.js +++ b/frontend/schemes/DynamicOpenIDConnectScheme.js @@ -25,7 +25,6 @@ export default class DynamicOpenIDConnectScheme extends OpenIDConnectScheme { return } - await this.updateAccessToken() const { data } = await this.$auth.requestWith(this.name, { url: "/api/users/self" }) @@ -33,6 +32,14 @@ export default class DynamicOpenIDConnectScheme extends OpenIDConnectScheme { this.$auth.setUser(data) } + async _handleCallback() { + const redirect = await super._handleCallback() + await this.updateAccessToken() + + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return redirect; + } + async updateAccessToken() { const response = await this.$auth.requestWith(this.name, { url: "/api/auth/token",