Skip to content

authentication example is broken/unusable #12441

Open
@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 (??) [email protected] 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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions