title: How do I pass dynamic param in nestjs facebook strategy callback url
body: <p>How do i pass some dynamic params in the facebook login callback url?</p>
  
  <p>I have different types of users (differentiated by a 'type' param) signing up using facebook login. I have created a facebook auth strategy using passport-facebook which works fine.</p>
  
  <p>However after authentication, when callback url is called, i need to know which type of user requested the signup. </p>
  
  <p>I'm guessing i can pass a param when defining the callback url</p>
  
  <p>something like this</p>
  
  <p><a href="http://localhost:3000/auth/facebook/callback/type1" rel="noreferrer">http://localhost:3000/auth/facebook/callback/type1</a>
  <a href="http://localhost:3000/auth/facebook/callback/type2" rel="noreferrer">http://localhost:3000/auth/facebook/callback/type2</a></p>
  
  <p>How do I pass a dynamic value into the FacebookStrategy??</p>
  
  <p>or whats the possible workaround to achieve this?</p>
  
  <p>// PassportStrategy.ts</p>
  
  <pre><code>@Injectable()
  export class FacebookStrategy extends PassportStrategy(Strategy) {
      constructor() {
          super({
              clientID: 'MYID',
              clientSecret: 'MYSCRET',
              callbackURL: "http://localhost:3000/auth/facebook/callback",
              profileFields: ['id', 'displayName', 'emails', 'photos']
          });
      }
  
      async validate(accessToken: any, refreshToken: any, profile: any) {
          return {
              name: profile.displayName,
              email: profile.emails[0].value,
              provider: "facebook",
              providerId: profile.id,
              photo: profile.photos[0].value
          }
      }
  }
  
  </code></pre>
  
  <p>// auth controller</p>
  
  <pre><code>@Controller('auth')
  export class AuthController {
      constructor(
          @Inject(forwardRef(() =&gt; AuthService)) private readonly authService: AuthService,
      ) { }
  
      @Get('/facebook')
      @UseGuards(AuthGuard('facebook'))
      async facebookAuth(@Request() req) {
          return
      }
  
      @UseGuards(AuthGuard('facebook'))
      @Get('/facebook/callback')
      async facebookCallback(@Request() req) {
          return this.authService.login(req.user);
      }
  
  }
  
  </code></pre>
  
  <p>Basically i want to be able to call "/auth/facebook/:type" and pass the type value in the callback url defined in the Strategy</p>
  
  <p>and callback endpoint to be something like "/auth/facebook/callback/:type"</p>
  
  <p>so when i call the authservice.login function i can pass that 'type' and decide which type of user to be created if its the first time signup </p>
  
  <p>Guide me if my approach is wrong. Thanks</p>