This is a Python package that allows you to acquire your RecNet access token and more with your cookie! 🍪
- Automatically renewing token
- Supports 2FA accounts
- Decoding the bearer token
- Detailed exceptions
Download the recnetlogin folder and place it in your project.
pip installation once this is stable.
- Login to RecNet. While logging in, make sure you toggle on "Remember me / my machine".
- Open your browser's DevTools (Inspect Element)
- Open the
Storage
orApplication
tab on the top - Locate
Cookies
>https://rec.net
on the directory - Search for
__Secure-next-auth.session-token
by filtering the cookies - Double click the value and copy it
- Search for environment variables and open the first result
- Click
Environment Variables...
- Click
New
under System Variables
- Name the variable
RN_COOKIE
and paste the copied value
-
Press OK on all the opened tabs
-
Restart your computer for it to take effect
- Make a new file named
.env.secret
in your project's directory - Type
RN_SESSION_TOKEN=
in the file and paste the copied value
- If the file is not in your project's directory, make sure to specify it
rnl = RecNetLogin(env_path=".env.secret") # Env path defaults to local directory
from RecNetLogin import RecNetLogin
rnl = RecNetLogin()
token = rnl.get_token()
decoded_token = rnl.get_decoded_token() # JWT decoded
print(token, decoded_token)
from recnetlogin import RecNetLogin
rnl = RecNetLogin(env_path=".env.secret")
# Fetch using RecNetLogin's HTTPX client
r = rnl.client.get("https://accounts.rec.net/account/me")
for key, value in r.json().items():
print(key, value)
# Close the client once done
rnl.close()