FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    FusionAuth and NestJS

    Scheduled Pinned Locked Moved
    Q&A
    2
    2
    580
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      Caesius
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • danD
        dan
        last edited by

        Hiya,

        A few questions for you?

        What version of FusionAuth are you running?

        What step throws the error?

        Did you walk through the 5 minute setup guide? That will ensure you have everything configured correctly on the FusionAuth side.

        --
        FusionAuth - Auth for devs, built by devs.
        https://fusionauth.io

        1 Reply Last reply Reply Quote 0
        • First post
          Last post