lijuanma1331
lijuanma1331
TTCTheo's Typesafe Cult
Created by Morraez on 6/6/2023 in #questions
Next Auth With username and password
I think this is the reason why you cant make it work.
6 replies
TTCTheo's Typesafe Cult
Created by Morraez on 6/6/2023 in #questions
Next Auth With username and password
Hi, im pretty new to this but ill try😀. Check the docs https://next-auth.js.org/providers/credentials the danger section.
6 replies
TtRPC
Created by DevR on 5/28/2023 in #❓-help
Next-auth session not being fetched in tRPC context
This is quite strange🤨
20 replies
TtRPC
Created by DevR on 5/28/2023 in #❓-help
Next-auth session not being fetched in tRPC context
My envinfo is
System:
OS: Windows 10 10.0.19044
CPU: (8) x64 Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
Memory: 11.07 GB / 23.94 GB
Binaries:
Node: 18.16.0 - ~\AppData\Local\Volta\tools\image\node\18.16.0\node.EXE
Yarn: 1.22.17 - ~\AppData\Local\Volta\tools\image\yarn\1.22.17\bin\yarn.CMD
npm: 9.5.1 - ~\AppData\Local\Volta\tools\image\node\18.16.0\npm.CMD
System:
OS: Windows 10 10.0.19044
CPU: (8) x64 Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
Memory: 11.07 GB / 23.94 GB
Binaries:
Node: 18.16.0 - ~\AppData\Local\Volta\tools\image\node\18.16.0\node.EXE
Yarn: 1.22.17 - ~\AppData\Local\Volta\tools\image\yarn\1.22.17\bin\yarn.CMD
npm: 9.5.1 - ~\AppData\Local\Volta\tools\image\node\18.16.0\npm.CMD
20 replies
TtRPC
Created by DevR on 5/28/2023 in #❓-help
Next-auth session not being fetched in tRPC context
So maybe next-auth related?
20 replies
TtRPC
Created by DevR on 5/28/2023 in #❓-help
Next-auth session not being fetched in tRPC context
Hi! Im getting the same error. To reproduce it just clone the websocket/subscriptions, follow the steps and on the first run the error will appear. I think this is the code where it fails
import * as trpc from '@trpc/server';
import * as trpcNext from '@trpc/server/adapters/next';
import { NodeHTTPCreateContextFnOptions } from '@trpc/server/adapters/node-http';
import { IncomingMessage } from 'http';
import { getSession } from 'next-auth/react';
import ws from 'ws';

/**
* Creates context for an incoming request
* @link https://trpc.io/docs/context
*/
export const createContext = async (
opts:
| trpcNext.CreateNextContextOptions
| NodeHTTPCreateContextFnOptions<IncomingMessage, ws>,
) => {
const session = await getSession(opts); // Always null

console.log('createContext for', session?.user?.name ?? 'unknown user');

return {
session,
};
};

export type Context = trpc.inferAsyncReturnType<typeof createContext>;
import * as trpc from '@trpc/server';
import * as trpcNext from '@trpc/server/adapters/next';
import { NodeHTTPCreateContextFnOptions } from '@trpc/server/adapters/node-http';
import { IncomingMessage } from 'http';
import { getSession } from 'next-auth/react';
import ws from 'ws';

/**
* Creates context for an incoming request
* @link https://trpc.io/docs/context
*/
export const createContext = async (
opts:
| trpcNext.CreateNextContextOptions
| NodeHTTPCreateContextFnOptions<IncomingMessage, ws>,
) => {
const session = await getSession(opts); // Always null

console.log('createContext for', session?.user?.name ?? 'unknown user');

return {
session,
};
};

export type Context = trpc.inferAsyncReturnType<typeof createContext>;
20 replies
TTCTheo's Typesafe Cult
Created by Stivo on 12/15/2022 in #questions
NextAuth CredentialsProvider + database strategy
Ok now i understand. Next Auth did that intentionally.
5 replies
TTCTheo's Typesafe Cult
Created by Stivo on 12/15/2022 in #questions
NextAuth CredentialsProvider + database strategy
Yes. Having the same problem. It works when using discord provider. But it does not store session using credentials.
5 replies