Skip to content
This repository was archived by the owner on Dec 20, 2021. It is now read-only.

Commit d6a0400

Browse files
committed
added function for login with Base64 credentials
1 parent d5101bf commit d6a0400

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

vrcpy/client.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,27 @@ def login(self, username, password):
292292
self.me = objects.CurrentUser(self, resp["data"])
293293
self.loggedIn = True
294294

295+
def loginb64(self, b64):
296+
'''
297+
Used to initialize the client for use
298+
299+
b64, string
300+
Base64 Encoding of VRC account credentials
301+
302+
Returns void
303+
'''
304+
305+
if self.loggedIn:
306+
raise AlreadyLoggedInError("Client is already logged in")
307+
308+
resp = self.api.call("/auth/user", headers={"Authorization": "Basic "+b64}, no_auth=True)
309+
310+
self.api.set_auth(b64)
311+
self.api.session.cookies.set("auth", resp["response"].cookies["auth"])
312+
313+
self.me = objects.CurrentUser(self, resp["data"])
314+
self.loggedIn = True
315+
295316
def login2fa(self, username, password, code=None, verify=False):
296317
'''
297318
Used to initialize client for use (for accounts with 2FactorAuth)

0 commit comments

Comments
 (0)