-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added 2FA, fix bugs, auto format file #37
base: main
Are you sure you want to change the base?
Conversation
For those who want to use this fork before being pulled, please click the link below |
Hey, |
I looked at the code and run it on my phone. I don't quite get how this will work indefinitely? I always thought that for 2FA support, i would need some logic in the code which calculates the current valid OTP based on the shared secret. Thanks for explaining |
And for those who have 2FA enabled, this message popup --EDIT-- |
okay setting the session timeout to 86400000s seems to be a reasonable solution ;) would just have to add this to the readme then which would be no problem. I noticed the problem that you cannot run the script inside the Scriptable app twice in a row when overwritePersistedConfig is true...this is probably not a good idea to have since playing around with e.g. the color settings (change color, run script, change color, run script, ...) would be a huge pain in the ass :) ... |
Maybe we should add to the docs? |
I know that it works after that. But the User will be confused... |
I'm actually debugging out the problem. It seems that Scriptable has some bugs when it goes to What am I trying to do
But I've face some problems and I've pushed a commit to my
|
I've re-coded the whole 2FA run down, which now can fetch the 2FA code from Authy by my new script The function is to check if they use the parameter method and enable 2FA, which is impossible as need to use the access token. The reason we need to use an access token instead of re-auth(ing) each time is that a 2FA token can be only used once. If you try to re-auth with the same 2FA code, it will throw an error and you need to wait for 30 seconds for a new 2FA code if (twoFactorAuthentication && foundCredentialsInParameter) {
throw ('You cannot use this method if you want to enable 2FA');
} If the user disables if (!usePersistedConfiguration && twoFactorAuthentication) {
CONFIGURATION.access_token = (await getPersistedObject(fm, pathToConfig, CONFIGURATION_JSON_VERSION, CONFIGURATION, false)).access_token;
log('Loaded access_token from config');
} |
The access token will be stored in the CONFIGURATION file, such that the token can be reused and doesn't need to be updated each time.