Skip to content

authentication example is broken/unusable #12441

@seccentral

Description

@seccentral

Documentation Issue

Following the instructions at https://github.com/payloadcms/payload/blob/main/examples/auth/README.md should land you on localhost:3000 with a working login/dashboard/logout flow but multiple steps are broken.

Additional Details

npx provisioning works.
Starting the dev server does not, as it immediately crashes due to inexistent payload_secret and connect db string. (suggestion: a small declaration of a ./db.sqlite should be fine for this purpose)
Fixing that leads to an error due to graphql missing.
Adding that finally allows the server to start on :3000 and leads to a page that displays one nextjs error :

Runtime Error


Error: SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

src/app/(app)/_providers/Auth/rest.ts (32:11) @ rest


  30 |     }
  31 |   } catch (e: unknown) {
> 32 |     throw new Error(e as string)
     |           ^
  33 |   }
  34 | }
  35 |****

Ignoring that, the showcased login does not work with provided credentials (??) demo@payloadcms.com and password demo.
Logging in via admin panel, however, works and going back to /login shows You are already logged in., however, clicking the logout button does nothing visually and inspecting the console shows

rest.ts:11 
 POST http://localhost:3000/undefined/api/users/logout 404 (Not Found)
rest.ts:11 
 POST http://localhost:3000/undefined/api/users/logout 404 (Not Found)

A bit confusing for a newbie, right ?

Activity

zubricks

zubricks commented on Jul 23, 2025

@zubricks
Member

Hey @seccentral I've just tested this and it looks like these issues have been resolved. An env with a payload secret is created for you, and you should be prompted to drop your database when spinning up a fresh project with the auth example, ensuring the demo user is added to your db.

Give this a shot—if you still run into an issue we can reopen.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @seccentral@zubricks

        Issue actions

          authentication example is broken/unusable · Issue #12441 · payloadcms/payload