puter icon indicating copy to clipboard operation
puter copied to clipboard

You can log out the global `me.puter` user in workers

Open reynaldichernando opened this issue 2 months ago • 4 comments

hi team, an interesting thing i found in workers

you can log out the global me.puter user by running puter.auth.signOut(), then it won't have access to the puter APIs anymore

router.get('/signout', async ({request}) => {
    try {
        const result = await me.puter.auth.signOut();
        return 'result: ' + result;
    } catch (error) {
        return 'error: ' +   error;
    }
});

router.get('/user', async ({request}) => {
    try {
        const user = JSON.stringify(await me.puter.auth.getUser());
        return 'result: ' + user;
    } catch (error) {
        return 'error: ' +   error;
    } 
});

^ in this code, calling the signout endpoint will result in the /user endpoint not returning the user the way to "log in" back is by redeploying the worker

not sure if this is something expected, but it will be super uncommon for worker devs to log themselves out anyway so i won't be suprised if this is wontfix, but just bringing it up here

reynaldichernando avatar Nov 04 '25 16:11 reynaldichernando

@ProgrammerIn-wonderland

jelveh avatar Nov 04 '25 23:11 jelveh

I'm guessing this just invalidates the API token

Yeah I think it can be safely disabled in workers

ProgrammerIn-wonderland avatar Nov 04 '25 23:11 ProgrammerIn-wonderland

can u disable it?

jelveh avatar Nov 04 '25 23:11 jelveh

Yeah

ProgrammerIn-wonderland avatar Nov 05 '25 00:11 ProgrammerIn-wonderland