Open BadCoder1337 opened 3 years ago
You can call setAuthFileName
method before you need to change ubi app id, it's non-ideal solution but a workaround.
const friendsApi = new R6API(credentials)
- const chatApi = new R6API({ ...credentials, ubiAppId: OVERLAY_APP_ID })
+ const chatApi = new R6API(credentials)
+ const defaultAppId = '3587dcbb-7f81-457c-9781-0e3f29f6f56a';
+ const altAppId = '83564d31-7cd7-4bc0-a763-6524e78d1a7f';
+ friendsApi.setAuthFileName(`r6api.js-auth-${defaultAppId}`);
const friendsApiAuth = await friendsApi.getAuth()
+ chatApi.setAuthFileName(`r6api.js-auth-${altAppId}`);
const chatApiAuth = await chatApi.getAuth()
console.log(friendsApiAuth, chatApiAuth)
@BadCoder1337 did example above resolve your issue?
I split code into separate workers. It's easier for me than creating and loading JSON. But the issue is still relevant as a refactor goal.
I need to create a different session with non-default
Ubi-AppId
to interact with another domain of endpoints. Example code:But because of global variables in
auth.ts
and other places I cannot construct 2nd R6API instance. getAuth from both instances gives the same object which is impossible sincesession
endpoint is non-idempotent.