How do i make snap get the logged in scratch user with cookies?

so, i'm making scratch 4.0 in snap, and i want to make it log in using cookies from scratch.
how do i do that?

You cannot do that, because if you could, malicious websites would be using that.


For security purposes, cookies can only be read by the website that owns them. If that wasn't the case, then a malicious website could read your Scratch cookies that have your session data, and that malicious website will have access to your Scratch account.


I don’t see why you would need to get the scratch user when we have the username block in getters and setters :stuck_out_tongue:

To log in to scratch 4.0 which connects to scratch

not possible

Yeah it is technically if you use the api

Now that I think about it using the api requires you to login, you could store that info and use it for that
(I still wouldn’t recommend doing this and instead you should make a way to use the snap account with it) just remember, DONT TRY TO ACESS THE SNAP CLOUD!

The username block gets the currently logged in Snap user.

Also, there is a way 3rd party scratch website have been able to let users log in with their scratch accounts. They give the user a code, which they then need to enter into a comment on a profile, project or inside a project (using cloud vars). The scratch wiki actually uses this method.

The downside is that you don't actually get any user info besides the username (and what's publicly available through the scratch api).

Ik about scratch auth, I’m saying that the api can also use a username and password to sign instead of a session id

You can give a username and password in the place of a session Id and the api accepts it

... which generates a session token which is needed to access some data