Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

Headless token refresh #30

Merged
merged 2 commits into from Apr 3, 2022
Merged

Headless token refresh #30

merged 2 commits into from Apr 3, 2022

Conversation

KalleStruik
Copy link
Contributor

Use reddit_session cookie to refresh the accessToken on headless bots. Currently still testing.
This PR changes the bot.js script to take a semicolon (;) separated list of cookies instead of a comma (,) separated list of accessTokens. The env variable is also changed from ACCESS_TOKEN to REDDIT_SESSION to reflect this

How to get reddit_session cookie

  1. Go to r/place
  2. Open dev tools and go to the network tab
  3. Refresh the page
  4. Click on the first request to reddit.com/r/place (See image)
    Screenshot_20220403_165251
  5. Go to the tab called Cookies
  6. Copy the value of the reddit_session cookie

@FloGo3308
Copy link
Contributor

dit is erg hard nodig!!!

@SpiderDead
Copy link
Contributor

Dit lijkt bij mij te werken. Zit zelf nog te wachten op een token refresh of dat goed werkt.

@nuc1e4r5n4k3
Copy link
Contributor

nuc1e4r5n4k3 commented Apr 3, 2022

Do we know whether the reddit session cookie can change? If so, we should capture the Set-Cookie header of the response and update redditSessionCookies with it.

@KalleStruik
Copy link
Contributor Author

Do we know whether the reddit session cookie can change? If so, we should capture the Set-Cookie header of the response and update redditSessionCookies with it.

I am pretty sure it is static (or at least valid for a long time), but I don't think it hurts to just do this anyway.

@KalleStruik
Copy link
Contributor Author

Token refresh just happened on my end btw and it seems to still be placing pixels after it.

@ArjenHolmer
Copy link
Contributor

Initial token request works on my end as well, waiting for the refresh now. so far so good!

bot.js Outdated Show resolved Hide resolved
bot.js Show resolved Hide resolved
@KalleStruik KalleStruik marked this pull request as ready for review April 3, 2022 15:36
@KalleStruik
Copy link
Contributor Author

Do we know whether the reddit session cookie can change? If so, we should capture the Set-Cookie header of the response and update redditSessionCookies with it.

Seems like this won't be easy to do after all, since the response to our request to /r/place does not return a set-cookie header for this cookie.

@SpiderDead
Copy link
Contributor

Refreshing works. Just auto refreshed 2 clients and placed a tile.

@NoahvdAa NoahvdAa merged commit 680225e into PlaceNL2022:master Apr 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants