Skip to content

Commit

Permalink
only request a mealie token on initial callback
Browse files Browse the repository at this point in the history
  • Loading branch information
cmintey committed Feb 23, 2024
1 parent 122fbf7 commit 0331515
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export default {
},
oidc: {
scheme: "~/schemes/DynamicOpenIDConnectScheme",
resetOnError: true,
clientId: "",
endpoints: {
configuration: "",
Expand Down
9 changes: 8 additions & 1 deletion frontend/schemes/DynamicOpenIDConnectScheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,21 @@ export default class DynamicOpenIDConnectScheme extends OpenIDConnectScheme {
return
}

await this.updateAccessToken()
const { data } = await this.$auth.requestWith(this.name, {
url: "/api/users/self"
})

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",
Expand Down

0 comments on commit 0331515

Please sign in to comment.