Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

225
Views
How to pass redirect_uri in next-auth?

I do authorization via next-auth

import NextAuth from 'next-auth';

export default NextAuth({
    providers: [
        {
            id: 'reddit',
            name: 'Reddit',
            clientId: process.env.CLIENT_ID,
            clientSecret: process.env.CLIENT_SECRET,
            scope: 'read submit identity',
            type: 'oauth',
            version: '2.0',
            params: { grant_type: 'authorization_code' },
            accessTokenUrl: ' https://www.reddit.com/api/v1/access_token',
            authorizationUrl: 'https://www.reddit.com/api/v1/authorize?response_type=code&duration=permanent',
            profileUrl: 'https://oauth.reddit.com/api/v1/me',
            profile: profile => {
                return {
                    id: profile.id as string,
                    name: profile.name,
                    email: null,
                };
            },
        },
    ],
});

And I am getting error from reddit /you sent an invalid request

  • invalid redirect_uri parameter./

How am I supposed to pass this uri in next-auth?

NEXTAUTH_URL variable is also specified

This is how next-auth inserts it into Request URL

redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fapi%2Fauth%2Fcallback%2Freddit

but I just need

http://localhost:8080
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I solved it) u just need to set redirect_uri in your reddit app as

http://localhost:8080/api/auth/callback/reddit
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!