schech1 / uptime-buddy

Uptime monitoring on Apple Watch
MIT License
31 stars 1 forks source link

Support for MFA #2

Open PhoenixSheppy opened 2 weeks ago

PhoenixSheppy commented 2 weeks ago

Please add support for MFA Tokens.

I personally use MFA tokens on my Uptime-Kuma instance, and had to disable them to implement uptime-buddy.

Also, Uptime-Kuma has support for API Keys, consider implementing those instead.

Thank you.

ivolanski commented 2 weeks ago

+1 for API keys

I can see that https://github.com/schech1/uptime-buddy/compare/master...mfa-auth-wip is preparing for MFA but use the uptime-kuma api token as a env var set in the docker compose is much better, cleaner and elegant solution.

uptime-kuma-api-token=os.getenv("UPTIME-KUMA-API-TOKEN")
login_by_token(uptime-kuma-api-token)
login_by_token(token: str) → dict

    Login by token.

    Parameters:

        token (str) – Login token generated by [login()](https://uptime-kuma-api.readthedocs.io/en/latest/api.html#uptime_kuma_api.UptimeKumaApi.login)
    Returns:

        The server response.
    Return type:

        dict
    Raises:

        [UptimeKumaException](https://uptime-kuma-api.readthedocs.io/en/latest/api.html#uptime_kuma_api.UptimeKumaException) – If the server returns an error.

    Example:

api.login_by_token(token)
{}
schech1 commented 2 weeks ago

@ivolanski I checked the login_by_token()-function but it's actually not as you imagine. It does not use the api-token. (as far as I understood) It uses a token, that is generated by the login()-function, that needs to be called before.

I can use the api token from Uptime Kuma, but I wanted to avoid typing a 20 char long token into the app. Therefore I used a 6 char long token for now.

I will also continue to check the 2FA authentication, just trying to find a solution, to implement it in an easy way, since the 2fa code is time relevant. Will figure out a way to set the 2FA up in the iOS-app and will create a TestFlight version from the mfa-auth-wip branch.

schech1 commented 5 days ago

Hey, if you would like to give it a try, I made an experimental version with 2FA support. You can use the public TestFlight invitation for the app: https://testflight.apple.com/join/okTxZGX1

Use the docker experimental tag for the backend. schech1/uptime-buddy-api:experimental

Add this env var to your docker compose

- MFA=True