Skip to content

Help with session based authentication flow #200

Discussion options

You must be logged in to vote

Thank you for the points about local dev nuances Ophir! But actually, I think it had to do with the path parameter in my case. I manually set path to '/' in the cookie component like so:

-- Generate a random session token
INSERT INTO sessions (token, user)
VALUES (sqlpage.random_string(32), (select id from users where username = :username))
RETURNING 
    'cookie' AS component,
    'session_token' AS name,
    token AS value,
    '/' AS path;

I maybe misunderstood the cookie component documentation. It says the path parameter defaults to all paths when left blank, but that seems to be the case for top-level files only.

I was using a file structure like:

├── sqlpage/
│   └── ...
├── ui/
│ …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@matthewlarkin
Comment options

Answer selected by matthewlarkin
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working
2 participants