inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

[코드캠프] 부트캠프에서 만든 고농축 백엔드 코스

소셜 로그인 리팩토링

그래프큐엘로 구글 로그인 질문있습니다.

해결된 질문

194

반가우면반갑다고해

작성한 질문수 142

0

 현재 아래와 같은 에러를 마주쳤습니다.

my-server_1    | TypeError: res.setHeader is not a function
my-server_1    |     at JwtGoogleStrategy.strategy.redirect (/myFolder/node_modules/passport/lib/middleware/authenticate.js:340:13)
my-server_1    |     at stored (/myFolder/node_modules/passport-oauth2/lib/strategy.js:285:14)
my-server_1    |     at NullStore.store (/myFolder/node_modules/passport-oauth2/lib/state/null.js:5:3)
my-server_1    |     at JwtGoogleStrategy.OAuth2Strategy.authenticate (/myFolder/node_modules/passport-oauth2/lib/strategy.js:297:28)
my-server_1    |     at attempt (/myFolder/node_modules/passport/lib/middleware/authenticate.js:378:16)
my-server_1    |     at authenticate (/myFolder/node_modules/passport/lib/middleware/authenticate.js:379:7)
my-server_1    |     at /myFolder/node_modules/@nestjs/passport/dist/auth.guard.js:88:3
my-server_1    |     at new Promise (<anonymous>)
my-server_1    |     at /myFolder/node_modules/@nestjs/passport/dist/auth.guard.js:80:83
my-server_1    |     at GqlAuthGuard.canActivate (/myFolder/node_modules/@nestjs/passport/dist/auth.guard.js:44:32)

제 코드는 다음과 같습니다.

 @UseGuards(GqlAuthGuard('google'))
  @Mutation(() => String)
  loginGoogle(
    @Context() context: IContext, //
  ): void {
    console.log('context::', context);
  }

import { PassportStrategy } from '@nestjs/passport';
import { Strategy } from 'passport-google-oauth20';

export class JwtGoogleStrategy extends PassportStrategy(Strategy, 'google') {
  constructor() {
    super({
      clientID: process.env.GOOGLE_CLIENT_ID,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET,
   
      callbackURL: 'http://localhost:3001/login',
      scope: ['email', 'profile'],
    });
  }

  validate(accessToken, profile) {
    console.log('profile:', profile);

    return {
     ...
    };
  }
}


혹시 제가 실수한 부분이있을까요?

javascript node.js docker rest-api nestjs

답변 3

0

노원두

안녕하세요! 반가우면반갑다고해님!

맨 위의 에러 내용을 보니, res.setHeader is not a function 이라고 되어 있네요!

  1. res 부분에 context.res가 제대로 전달되고 있는지 확인이 필요할 것 같아요!

  2. 만약, 제대로 전달되고 있는 것 같다면, 추가적으로 app.module에서 GraphqlModule의 context 설정에서 req, res가 제대로 전달되고 있는지 확인해 주세요!

     

    GraphQLModule.forRoot<ApolloDriverConfig>({
        context: ({ req, res }) => ({ req, res }), // req는 기본적으로 들어오지만, res는 이걸 작성해야만 들어옴
    }),

     

0

rina carlos

SITUS SLOT GACOR TERBAIK DAN TERPERCAYA

new 1.jpg

 

FURI88 : DAFTAR LINK SLOT GACOR TERBAIK
HARI INI

Menyediakan beragam jenis permainan GAME SLOT Terlengkap dan tergacor

Pragmatic Play | PG soft | spadeGaming | JOKER | Habanero | NoLimit | PlayStar,

NextSpin | AdvantPlay | Microgaming | FLOW Gaming | CQ9 Gaming | Red Tiger -

dan masih banyak Provider Game Slot tergacor lainnya.

https://www.billetcool.com/

https://freehostnews.com/

https://99naga.com/

https://fondafrontera.com/

https://loftiespacesandevents.com/

https://www.politeknik-med/

https://reciperaaga.com/

https://www.ivermectinoral.com/

https://slotgacor-7oa.pages.dev/

https://slot-gacor-dse.pages.dev/

https://pauldsmart.com/

https://benejim.info/

https://furi88win.tumblr.com/
#FURI88 #FURI88 SLOT GACOR #FURI88 SITUS SLOT

-2

Furi88online

FURI88.ONLINE

그래프 ql 문서 사용할때 느낌표 남는거 어떻게 없애나요?

0

86

2

강의 전체 소스 코드를 받고싶습니다.

0

76

2

fontawesome 사용 문의

0

79

2

소스 코드 부탁드립니다~

0

85

2

깃 레포지터리 소스

0

87

2

커리큘럼12.css 정렬 에 나오는 과제 정답알고싶어요

0

74

2

10-01 Entity TypeOrmModule.forRoot 에 entities

0

89

3

강의 버전관련 문의입니다

0

104

2

Ubuntu 설치 관련

0

62

1

schema.gql 질문 드립니다.

0

51

1

서버 재실행시 Many to Many

0

102

3

input 관련 문의

0

90

2

Rest API 보다는 graphql이 주된 내용인데

0

131

2

강의 전체 소스코드 받을수있을까요?

0

156

1

도커볼륨 마운트 관련

0

127

2

findOne 타입스크립트오류

0

109

1

http => htrtps 호출 인증서 신뢰 오류

0

356

1

self-signed certificate in certificate chain 에러 발생

0

420

1

mongoose 설치 오류

0

142

1

특정 API, 특정 IP 허용 (단일경로에 CORS 활성화)

0

284

2

08-06

0

180

3

구조랑 패턴 관련해서 질문

0

126

2

mydocker

0

129

2

coolsms statuscode 2000 인데 전송안돼는 경우 확인.

0

156

1