Skip to content

Commit

Permalink
fix(auth): avoid fetching profile via proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
ygrishajev committed Aug 16, 2024
1 parent 2dbf6b1 commit ffce24e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions apps/deploy-web/src/services/user/user-http.service.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import { HttpService } from "@akashnetwork/http-sdk";
import type { UserProfile } from "@auth0/nextjs-auth0/client";
import { InternalAxiosRequestConfig } from "axios";

import { authService } from "@src/services/auth/auth.service";
import { ANONYMOUS_USER_TOKEN_KEY } from "@src/utils/constants";

export class UserHttpService extends HttpService {
constructor() {
super();
this.getProfile = this.getProfile.bind(this);
this.interceptors.request.use(authService.withAnonymousUserHeader);
this.interceptors.request.use((config: InternalAxiosRequestConfig) => {
const token = localStorage.getItem(ANONYMOUS_USER_TOKEN_KEY);

if (token) {
config.headers.set("authorization", `Bearer ${token}`);
}

return config;
});
}

async getProfile(url: string) {
Expand Down

0 comments on commit ffce24e

Please sign in to comment.