Hey I cannot for the life of me understand why I am unable to resolve this redirect uri mismatch error I keep getting.
I have a NextJS app where I am trying to allow users to click to sign-in and give access to the google calendar. I was able to get it to work successfully for one uri. However all my attempts to add a second uri have been blocked by this error. I've triple-checked to ensure no spaces, trailing slashes, or letter cases were the issue. I've double-checked to make sure the client id and secret were correctly stored in my env variables. However, nothing seems to work.
My current workaround is using the working uri and modifying the code to handle multiple situations. But I would rather just separate the logic instead of sending multiple instances for different sets of users to the same redirect uri. I have attached a code snippet with the problematic code, snippet from the working code with the other uri, and a screenshot of my client setup. Just to note, when I directed the problematic code to the working uri it sent me to the next oauth screen successfully.
Broken Code:
Working Code:
OAuth Client Setup