You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not only does this file format not support multi-auth at all (which is something we want in the future to allow you to call/push actors from/to an organization account), it also stores a lot of information that the CLI realistically doesn't need or use.
What should be done
I'd personally see this as a multi-step process
Figure out a new structure for the file
I'd leave this up to the person implementing this how they want to do it. Here's two examples I can think off
// Alias for claritytypeUserId=string;exporttypeAuthFile=Record<UserId,Data>;// orexporttypeAuthFile=({userId: UserId;}&Data)[];// or some other type you may find makes best sense in this case
The format needs to support storing between 0 and n user/organizations and their tokens.
Figure out what data we actually need to store vs data we can/should just fetch on demand and cache at runtime
Token is mandatory for...obvious reasons.
Username is a maybe, since it'd be a cached value that doesn't get updated if you rename yourself on the console (feature request? :D)
Profile? Email? Plan? Probably not something we need to cache all the time, but something we can fetch if we really need it for a command
Proxy? Probably need it for apify run only.
Write the code assuming you have no existing auth file at all, and test it out with 1-user auth and with multi-auth
More less the easiest part once first two tasks are done. Whoever is implementing this can just start with a "blank" slate. You might need to adjust some things (specifically test hooks) for which you can/should ping me if you need guidance. You should also adjust the whois command to print out all logged in accounts
TL;DR: Assume you are a logged out user and you call apify login for the very first time. Code should focus on logging in, then storing the data correctly.
Then try logging in with another account.
Then see what whois prints out
Then try logging out from one of the accounts.
Write code to migrate the old structure to the new one
This ideally can be an oclif hook (possibly prerun, with checking which cmd is ran, or just in general). This also needs testing, which may be harder to achieve, so definitely feel free to ping for help. Ideally we should have some way to detect if the file is in old format versus the new format (version field or similar)
Open the PR
???
profit
The text was updated successfully, but these errors were encountered:
The current structure for our
auth.json
file, alongside it's code, is quite a mess...Not only does this file format not support multi-auth at all (which is something we want in the future to allow you to call/push actors from/to an organization account), it also stores a lot of information that the CLI realistically doesn't need or use.
What should be done
I'd personally see this as a multi-step process
Figure out a new structure for the file
I'd leave this up to the person implementing this how they want to do it. Here's two examples I can think off
The format needs to support storing between 0 and n user/organizations and their tokens.
Figure out what data we actually need to store vs data we can/should just fetch on demand and cache at runtime
Token is mandatory for...obvious reasons.
Username is a maybe, since it'd be a cached value that doesn't get updated if you rename yourself on the console (feature request? :D)
Profile? Email? Plan? Probably not something we need to cache all the time, but something we can fetch if we really need it for a command
Proxy? Probably need it for
apify run
only.Write the code assuming you have no existing auth file at all, and test it out with 1-user auth and with multi-auth
More less the easiest part once first two tasks are done. Whoever is implementing this can just start with a "blank" slate. You might need to adjust some things (specifically test hooks) for which you can/should ping me if you need guidance. You should also adjust the whois command to print out all logged in accounts
TL;DR: Assume you are a logged out user and you call
apify login
for the very first time. Code should focus on logging in, then storing the data correctly.Then try logging in with another account.
Then see what whois prints out
Then try logging out from one of the accounts.
Write code to migrate the old structure to the new one
This ideally can be an oclif hook (possibly
prerun
, with checking which cmd is ran, or just in general). This also needs testing, which may be harder to achieve, so definitely feel free to ping for help. Ideally we should have some way to detect if the file is in old format versus the new format (version field or similar)Open the PR
???
profit
The text was updated successfully, but these errors were encountered: