You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have set a dummy redirectTo: /about in my signIn but when I trigger the action it loops back onto the login page with this URL: http://localhost:3000/auth/login?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2Fabout.
I am using the following cofiguration:
Dockerfile
FROM node:18-alpine as base
ENV NEXT_TELEMETRY_DISABLED 1
ENV PNPM_HOME="/pnpm"ENV PATH="$PNPM_HOME:$PATH"ENV NEXT_TELEMETRY_DISABLED 1
# enbable corepack to use pnpmRUN corepack enable
COPY . /pulsecare-webapp
WORKDIR /pulsecare-webapp
FROM base AS deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
# Trying to freshly install prisma client every time as suggested here: https://github.com/prisma/prisma/issues/7234#issuecomment-846606919RUN pnpm dlx prisma generate --schema=prisma/schema.prisma
FROM deps as development
ENV HOSTNAME "0.0.0.0"ENV PORT 3000
CMD ["pnpm", "dev"]
docker-compose.yaml:
version: "3.1"services:
mongo6:
profiles:
- devbuild:
context: ./mongodb_rsargs:
MONGO_VERSION: 6environment:
# https://github.com/prisma/prisma/issues/11925MONGO_REPLICA_HOST: 127.0.0.1MONGO_REPLICA_PORT: 27018# Use "mongo" instead of "mongosh" before v5.0MONGO_COMMAND: "mongosh"ports:
- "27018:27018"restart: always# networks:# - pulsecare-netweb_prod:
profiles:
- prodrestart: alwaysbuild:
context: ..dockerfile: docker/Dockerfiletarget: productionports:
- "3000:3000"web_dev:
profiles:
- devrestart: alwaysenvironment:
# README: https://github.com/prisma/prisma/discussions/23790#discussioncomment-9060992
- DATABASE_URL=mongodb://mongo6:27018/pulsecare-web?replicaSet=rs0&retryWrites=true&w=majority&directConnection=true# For WSL: https://www.reddit.com/r/nextjs/comments/1638ec6/comment/jy1h8ys/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
- WATCHPACK_POLLING=truebuild:
context: ..dockerfile: docker/Dockerfiletarget: developmentports:
- "3000:3000"depends_on:
- mongo6links:
- mongo6# networks:# - pulsecare-net# This is only for hot reload in developmentvolumes:
- ../:/pulsecare-webapp
- /pulsecare-webapp/node_modules
- /pulsecare-webapp/.next
importNextAuthfrom"next-auth";importauthConfigfrom"./auth.config";import{PrismaAdapter}from"@auth/prisma-adapter";importdbfrom"./lib/prisma-client";exportconst{handlers: {GET,POST},
auth,
signIn,
signOut,}=NextAuth({pages: {signIn: "/auth/login",error: "/auth/error",},callbacks: {asyncsignIn({ user, account }){console.log("signin auth callback...")redirectif(account?.provider!=="credentials")returntrue;// await connectToDB();// const existingUser = await User.findOne({ email: user.email });// // // Allow OAuth without email verificationreturntrue;},asyncsession({ session, token, user }){// await connectToDB();// if (token.sub && session.user) {// session.user.id = token.sub;// }// if (token.role && session.user) {// session.user.role = token.role// }// // Send properties to the client, like an access_token and user id from a provider.returnsession;},// README: we decided to use JWT as strategy, hence we need to define itasyncjwt({ token, account, profile }){// await connectToDB();// if (!token.sub) return token;// const existingUser = await User.findById(token.sub)// if (!existingUser) return token;// token.role = existingUser.rolereturntoken;},},adapter: PrismaAdapter(db),session: {strategy: "jwt"},
...authConfig,});
The text was updated successfully, but these errors were encountered:
DavDeDev
added
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Apr 9, 2024
DavDeDev
changed the title
Callback URL inside Docker container
Callback URL inside Docker container doesn't work
Apr 9, 2024
Environment
Reproduction URL
CC-Comp308001-Group04/pulsecare-web#11
Describe the issue
I have set a dummy
redirectTo: /about
in mysignIn
but when I trigger the action it loops back onto the login page with this URL:http://localhost:3000/auth/login?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2Fabout
.I am using the following cofiguration:
How to reproduce
auth.ts
:Expected behavior
I would like to be redirected to
/about
The text was updated successfully, but these errors were encountered: