File tree Expand file tree Collapse file tree
examples/with-payload-local-strategy/src/collections
dev/src/payload/collections Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ const Users: CollectionConfig = {
1212 * @see https://payloadcms.com/docs/authentication/api-keys
1313 */
1414 useAPIKey : true ,
15- useSessions : false , // TODO: Database sessions currently not working
1615 } ,
1716 fields : [ ] ,
1817} ;
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ const Users: CollectionConfig<"users"> = {
2020 requireEmail : true ,
2121 requireUsername : false ,
2222 } ,
23- useSessions : false , // TODO: Database sessions currently not working
2423 } ,
2524 defaultPopulate : {
2625 id : true ,
Original file line number Diff line number Diff line change @@ -122,7 +122,12 @@ export const generateUsersCollection = (
122122 ...authOptions ,
123123 strategies : [ AuthjsAuthStrategy ( collection ) , ...( authStrategies ?? [ ] ) ] ,
124124 // Disable local strategy if not explicitly enabled
125- ...( pluginOptions . enableLocalStrategy === true ? { } : { disableLocalStrategy : true } ) ,
125+ ...( pluginOptions . enableLocalStrategy === true
126+ ? {
127+ // Database sessions not working with local strategy
128+ useSessions : false ,
129+ }
130+ : { disableLocalStrategy : true } ) ,
126131 } ;
127132
128133 // Add hooks to users collection
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ export interface AuthjsPluginConfig {
4040 * Enable the default local strategy from Payload CMS (experimental)
4141 * @see https://payloadcms.com/docs/authentication/jwt
4242 *
43+ * ! This does not work with database sessions (auth.useSessions: true)
44+ *
4345 * @default false
4446 */
4547 enableLocalStrategy ?: boolean ;
Original file line number Diff line number Diff line change @@ -17,9 +17,6 @@ export default buildConfig({
1717 collections : [
1818 {
1919 slug : "users-with-local-strategy" ,
20- auth : {
21- useSessions : false ,
22- } ,
2320 fields : [ ] ,
2421 } ,
2522 ] ,
You can’t perform that action at this time.
0 commit comments