realcoloride / node_characterai

Unofficial Character AI wrapper for node.
https://beta.character.ai/
341 stars 72 forks source link

sessionToken gone? #159

Open sivertheisholt opened 5 months ago

sivertheisholt commented 5 months ago

Looks like sessionToken is gone as they have moved to https://character.ai/?

It doesn't show up if I go back to the old page anymore either.

then77 commented 5 months ago

not really, but its harder to find. recommend try to go to the old website instead. https://old.character.ai/ (it just the same as the beta version)

but if you still curious, yes it's still possible at least for now. go to network tab, try to click any of the AI character, then find something like this (anything that says plus.character.ai) image

and you'll find it in the request authorization header. image

sivertheisholt commented 5 months ago

not really, but its harder to find. recommend try to go to the old website instead. https://old.character.ai/ (it just the same as the beta version)

but if you still curious, yes it's still possible at least for now. go to network tab, try to click any of the AI character, then find something like this (anything that says plus.character.ai) image

and you'll find it in the request authorization header. image

Thank you! :)

The readme might need an update for this @realcoloride

realcoloride commented 5 months ago

Hello, i'll investigate and see.

I will keep you updated!

realcoloride commented 5 months ago

image Hello there, upon investigation, for the new UI, you can check the session token there.

I havent tested yet but it seems like it matches when doing requests & I will update the README to include for the new and old interface.

I will keep you updated!

iegl3 commented 5 months ago

image Hello there, upon investigation, for the new UI, you can check the session token there.

I havent tested yet but it seems like it matches when doing requests & I will update the README to include for the new and old interface.

I will keep you updated!

are they changed the sessionToken method again? i can't find any key related to this

realcoloride commented 5 months ago

are they changed the sessionToken method again? i can't find any key related to this

You can still find it in the cookies (in the new interface).

PasanSilva99 commented 5 months ago

Yea, for me, it appeared after refreshing the page while standing on the chat

realcoloride commented 5 months ago

That must mean you were logged off and logged in back.

iegl3 commented 5 months ago

That must mean you were logged off and logged in back.

okay i got the token, and where should i put these token now?

realcoloride commented 5 months ago

See README.md for an example usage.

ThisMe124 commented 5 months ago

image Hello there, upon investigation, for the new UI, you can check the session token there.

I havent tested yet but it seems like it matches when doing requests & I will update the README to include for the new and old interface.

I will keep you updated!

I can't find that Token

iegl3 commented 5 months ago

See README.md for an example usage.

i've already read your readme 10 times but still cant find the information about how to use the token

sivertheisholt commented 5 months ago

See README.md for an example usage.

i've already read your readme 10 times but still cant find the information about how to use the token

image

iegl3 commented 5 months ago

See README.md for an example usage.

i've already read your readme 10 times but still cant find the information about how to use the token

image

yeah i know this, the problem is where should i specify the token? image bukti

sivertheisholt commented 5 months ago

See README.md for an example usage.

i've already read your readme 10 times but still cant find the information about how to use the token

image

yeah i know this, the problem is where should i specify the token? image bukti

You pass the token into the authenticateWithToken function like this:

.authenticateWithToken("insert token here");
iegl3 commented 5 months ago

See README.md for an example usage.

i've already read your readme 10 times but still cant find the information about how to use the token

image

yeah i know this, the problem is where should i specify the token? image bukti

You pass the token into the authenticateWithToken function like this:

.authenticateWithToken("insert token here");

ah i see.. okay it's clear, thanks for solution

realcoloride commented 5 months ago

image Hello there, upon investigation, for the new UI, you can check the session token there. I havent tested yet but it seems like it matches when doing requests & I will update the README to include for the new and old interface. I will keep you updated!

I can't find that Token

Hello, have you tried refreshing or getting the token via sniffing the network requests?

sivertheisholt commented 5 months ago

@realcoloride do you think it would be possible to add a way for users to log in themself via a browser popup, then retrieve the token directly?

realcoloride commented 5 months ago

@realcoloride do you think it would be possible to add a way for users to log in themself via a browser popup, then retrieve the token directly?

Hello, while that might be possible (I believe you are referencing something like the OpenAI free package), I do not plan on adding such a feature for now. However, a user friendly version with a simple code (in the README.md) to copy & paste in the old beta UI should still do the trick.

sivertheisholt commented 5 months ago

That must mean you were logged off and logged in back.

Trying this myself, and the HTTP_AUTHORIZATION doesn't get set before navigating to chat.

realcoloride commented 5 months ago

That must mean you were logged off and logged in back.

Trying this myself, and the HTTP_AUTHORIZATION doesn't get set before navigating to chat.

Right, thanks for letting me know

ThisMe124 commented 5 months ago

image Hello there, upon investigation, for the new UI, you can check the session token there. I havent tested yet but it seems like it matches when doing requests & I will update the README to include for the new and old interface. I will keep you updated!

I can't find that Token

Hello, have you tried refreshing or getting the token via sniffing the network requests?

Fixed i found the token

KuntilBogel commented 4 months ago

@realcoloride this is the updated readme code

(function(){let e=JSON.parse(document.querySelector("#__NEXT_DATA__").text)?.props?.pageProps?.token;if(!e){alert("You need to log in first! Or access a character page");return;}document.documentElement.innerHTML=`<div><i><p>provided by node_characterai - <a href="https://github.com/realcoloride/node_characterai?tab=readme-ov-file#using-an-access-token">click here for more information</a></p></i><p>Here is your session token:</p><input value="${e}" readonly><p><strong>Do not share this with anyone unless you know what you are doing! This is your personal session token. If stolen or requested by someone you don't trust, they could access your account without your consent; if so, please close the page immediately.</strong></p><button id="copy" onclick="navigator.clipboard.writeText('${e}'); alert('Copied to clipboard!')">Copy session token to clipboard</button><button onclick="window.location.reload();">Refresh the page</button></div>`;e=null;})();
realcoloride commented 4 months ago

@realcoloride this is the updated readme code

(function(){let e=JSON.parse(document.querySelector("#__NEXT_DATA__").text)?.props?.pageProps?.token;if(!e){alert("You need to log in first! Or access a character page");return;}document.documentElement.innerHTML=`<div><i><p>provided by node_characterai - <a href="https://github.com/realcoloride/node_characterai?tab=readme-ov-file#using-an-access-token">click here for more information</a></p></i><p>Here is your session token:</p><input value="${e}" readonly><p><strong>Do not share this with anyone unless you know what you are doing! This is your personal session token. If stolen or requested by someone you don't trust, they could access your account without your consent; if so, please close the page immediately.</strong></p><button id="copy" onclick="navigator.clipboard.writeText('${e}'); alert('Copied to clipboard!')">Copy session token to clipboard</button><button onclick="window.location.reload();">Refresh the page</button></div>`;e=null;})();

Do you quote this for the new interface?

gamersindo1223 commented 4 months ago

@realcoloride yeah

gamersindo1223 commented 4 months ago

and just asking is it just me or is the package currently broken?

gamersindo1223 commented 4 months ago

cuz sometimes I got ProtocolError: Could not load body for this request. This might happen if the request is a preflight request.

realcoloride commented 4 months ago

and just asking is it just me or is the package currently broken?

Works fine to me. If you get an error, please make sure to either open an issue or let me know.

realcoloride commented 4 months ago

@realcoloride yeah

I'll review the code and consider adding this to the README.md. Thank you for the contribution

Momenx1 commented 4 months ago

image Hello there, upon investigation, for the new UI, you can check the session token there.

I havent tested yet but it seems like it matches when doing requests & I will update the README to include for the new and old interface.

I will keep you updated!

Hey man i can't find that token

realcoloride commented 4 months ago

image Hello there, upon investigation, for the new UI, you can check the session token there.

I havent tested yet but it seems like it matches when doing requests & I will update the README to include for the new and old interface.

I will keep you updated!

Hey,

Have you tried this?

Cheers

sivertheisholt commented 4 months ago

image Hello there, upon investigation, for the new UI, you can check the session token there. I havent tested yet but it seems like it matches when doing requests & I will update the README to include for the new and old interface. I will keep you updated!

Hey man i can't find that token

You have to open a chat for it to set the token.

Momenx1 commented 4 months ago

image Hello there, upon investigation, for the new UI, you can check the session token there. I havent tested yet but it seems like it matches when doing requests & I will update the README to include for the new and old interface. I will keep you updated!

Hey,

Have you tried this?

Cheers

i have tried it and i can't find it

Momenx1 commented 4 months ago

image Hello there, upon investigation, for the new UI, you can check the session token there. I havent tested yet but it seems like it matches when doing requests & I will update the README to include for the new and old interface. I will keep you updated!

Hey,

Have you tried this?

Cheers

Screenshot (1)

I can't find it

sivertheisholt commented 4 months ago

image Hello there, upon investigation, for the new UI, you can check the session token there. I havent tested yet but it seems like it matches when doing requests & I will update the README to include for the new and old interface. I will keep you updated!

Hey, Have you tried this? Cheers

Screenshot (1)

I can't find it

It should show up once you go into a chat with a character, if not maybe a relog will work:

image

Momenx1 commented 4 months ago

image Hello there, upon investigation, for the new UI, you can check the session token there. I havent tested yet but it seems like it matches when doing requests & I will update the README to include for the new and old interface. I will keep you updated!

Hey, Have you tried this? Cheers

Screenshot (1) I can't find it

It should show up once you go into a chat with a character, if not maybe a relog will work:

image

Yup tried it and relogged and i can't find it.

realcoloride commented 4 months ago

Alright, I'll investigate and look into it.