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

Commit 8680656

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

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

vrcpy/client.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,30 @@ async def login(self, username, password):
671671

672672
await self.me.cacheTask
673673

674+
async def loginb64(self, b64):
675+
'''
676+
Used to initialize the client for use
677+
678+
b64, string
679+
Base64 Encoding of VRC account credentials
680+
681+
Returns void
682+
'''
683+
684+
if self.loggedIn:
685+
raise AlreadyLoggedInError("Client is already logged in")
686+
687+
resp = await self.api.call("/auth/user", headers={"Authorization": "Basic "+b64}, no_auth=True)
688+
689+
self.api.openSession(b64)
690+
self.api.session.cookie_jar.update_cookies(
691+
[["auth", resp["response"].headers["Set-Cookie"].split(';')[0].split("=")[1]]])
692+
693+
self.me = aobjects.CurrentUser(self, resp["data"])
694+
self.loggedIn = True
695+
696+
await self.me.cacheTask
697+
674698
async def login2fa(self, username, password, code=None, verify=False):
675699
'''
676700
Used to initialize client for use (for accounts with 2FactorAuth)

0 commit comments

Comments
 (0)