Skip to content

Commit

Permalink
fix: attempt to fix auth issue (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
tructn committed Nov 27, 2024
1 parent 8dd3235 commit d4063d5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
9 changes: 2 additions & 7 deletions frontend/src/common/httpservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,12 @@ const client = axios.create({

async function getAuthHeaders() {
try {
const token = await auth0.getTokenSilently({
authorizationParams: {
scope: "read:current_user",
audience: import.meta.env.VITE_AUTH0_AUDIENCE
}
});
const token = await auth0.getTokenSilently();
return {
Authorization: `Bearer ${token}`
};
} catch (e) {
alert(`Unable to get access token: ${e}`);
alert(e);
return {};
}
}
Expand Down
36 changes: 18 additions & 18 deletions frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@ const theme = createTheme({

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<BrowserRouter>
<QueryClientProvider client={queryClient}>
<MantineProvider theme={theme}>
<ModalsProvider>
<Auth0Provider
domain={import.meta.env.VITE_AUTH0_DOMAIN}
clientId={import.meta.env.VITE_AUTH0_CLIENTID}
authorizationParams={{
audience: import.meta.env.VITE_AUTH0_AUDIENCE,
redirect_uri: window.location.origin,
}}
cacheLocation="memory"
>
<Auth0Provider
domain={import.meta.env.VITE_AUTH0_DOMAIN}
clientId={import.meta.env.VITE_AUTH0_CLIENTID}
authorizationParams={{
audience: import.meta.env.VITE_AUTH0_AUDIENCE,
redirect_uri: window.location.origin,
}}
cacheLocation="memory"
>
<BrowserRouter>
<QueryClientProvider client={queryClient}>
<MantineProvider theme={theme}>
<ModalsProvider>
<App />
<Notifications />
</Auth0Provider>
</ModalsProvider>
</MantineProvider>
</QueryClientProvider>
</BrowserRouter>
</ModalsProvider>
</MantineProvider>
</QueryClientProvider>
</BrowserRouter>
</Auth0Provider>
</React.StrictMode>,
);

0 comments on commit d4063d5

Please sign in to comment.