You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
pvr325i
9 months agoExplorer | Level 3
Next.js 14 oAuth 2.0 authorization flow redirect 401 error
Hi first time poster here. I've got the authorization flow successfully integrated up to the point where the callback url appears in the browser address window, ie: http://localhost:3000/api/dr...
Greg-DB
Dropbox Staff
pvr325i Здравко is correct; based on that output, that error is coming from your http://localhost:3000 server, so you'd need to check on what it is doing on its /api/dropboxcallback page. For instance, check your server logs and debug the code it is running.
pvr325i
9 months agoExplorer | Level 3
So both of my replies seem to have been deleted. I would be grateful if I could understand why that was.
I appear to have solved the issue, with the hurdle being a conceptually different understanding to what the redirect url was meant to represent.
I originally had the redirect url representing an api route in a Next.js 14 app using the app router.
When I had a moment of differentiation, I changed the redirect url to the client side page from which the authorization process had commenced (the clicking of a button) (SOURCE PAGE); although the GET 401 error still appeared in the console, after about 1 second of a blank browser, the SOURCE PAGE did appear, with the url containing the code obtained from the authorization flow. Once this was accomplished, it was a matter of grabbing the code from the url, and then passing this to the api route which swapped this for an access token.
So, I guess, when @Greg-DB said I " need[ed] to check on what it is doing on its /api/dropboxcallback page" in essence he was right, but it took some time to understand what essentially he meant by this - which is, as is my current understanding, this should not be an api route, rather a client-side page from which the code in the url can be obtained, and then sent to an api route to exchange for an access token.
I appreciate there are a few examples of how this oauth process works, with working code examples, but as I presume this is meant to be deployed in a front end application, it would be good to have at least one example of how it is meant to be used in a front end framework (of some language) and not just in node.js.
However I got here, I am very glad it appears to be working.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,888 PostsLatest Activity: 17 hours agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!