Hi,
I’m developing a Next.js application with the next-auth library to integrate Auth0 as the provider. In my application when I try to login with Auth0, I get the following error and the login fails.
Protocol "http:" not supported. Expected "https:"
Could someone please help me understand what is going on and how to get the login to work?
next-auth v3.27.3
How to reproduce:
Use the following project and specify Auth0 provider configuration
Then start the app and try to log in with Auth0.
Thanks,
Ishan.
Hey there @udeshike !
Unfortunately we won’t be able to advise you here as the repo you mentioned above isn’t an official repo maintained by Auth0. Maybe someone else from community will be able to help!
Hi Konrad,
Thank you for your reply. However, unfortunately the issue is not limited to next-auth library. I can reproduce this with Auth0’s own quickstarts.
How to reproduce:
Log in to Auth0 and go to applications
Choose an application and go to the “Quick Start” tab. Then select Next.js and download the generated zip file.
Configure the Auth0 application with the correct callback and logout URLs.
Extract and run the Next.js application
Login with Google.
Login fails with the following error in the browser window
access_denied (Protocol "http:" not supported. Expected "https:")
redirected to:
http://localhost:3000/api/auth/callback?error=access_denied&error_description=Protocol%20%22http%3A%22%20not%20supported.%20Expected%20%22https%3A%22&state=...
Errors in the Next.js application log:
0] HandlerError [BadRequestError]: access_denied (Protocol "http:" not supported. Expected "https:")
[0] at Object.<anonymous> (.../sample-01/node_modules/@auth0/nextjs-auth0/dist/handlers/callback.js:31:19)
[0] at Generator.throw (<anonymous>)
[0] at rejected (.../sample-01/node_modules/tslib/tslib.js:115:69)
[0] at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[0] status: 400
Source code of the quick start application:
Would you be able to help me fix this?
Thanks,
Ishan.