FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login
    1. Home
    2. Caesius
    3. Posts
    C
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by Caesius

    • FusionAuth and NestJS

      Hi,

      So i have a controller file with the code below :

      @Controller()
      export class AuthController {
      
        @Get('/oauth-redirect')
        discordLoginCallback(@Req() req, @Res() res)
        {
          client.exchangeOAuthCodeForAccessToken(req.query.code,
            clientId,
            clientSecret,
            'http://localhost:3000/oauth-redirect')
      
            .then((response) => {
              return client.retrieveUserUsingJWT(response.response.access_token);
            })
            .then((response) => {
              req.session.user = response.response.user;
            })
            .then((response) => {
              res.redirect(302, '/');
            })
            .catch((err) => {console.log("in error"); console.error(JSON.stringify(err));
          });
      
        }
      
      }
      

      When i use the URL "http://localhost:9011/oauth2/authorize?client_id="clientId"&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Foauth-redirect", i have this message in my console :

      in error {}
      

      And nothing else. Is there someone who can help me ? Thanks in advance.

      posted in Q&A
      C
      Caesius