muety / wakapi

📊 A minimalist, self-hosted WakaTime-compatible backend for coding statistics
https://wakapi.dev
MIT License
2.38k stars 147 forks source link

Wakatime OAuth 2 authentication support #94

Open muety opened 3 years ago

muety commented 3 years ago

In addition to #28 and #87

alexanderadam commented 1 year ago

It would be great if the OAuth 2 extension OpenID Connect (OIDC) would be supported specifically. OpenID Connect is probably most widely adapted solution.

So that folks using KanIDM, Authelia, Keycloak, Authentik or GitLab or Nextcloud could use these for authentication.

Configuration usually requires some URLs and secrets.

For selfhosting having some ENV variables would probably be sufficient (OAUTH2_SITE_URL, OAUTH2_CLIENT_SECRET, OAUTH2_CLIENT_ID). Otherwise an example for the settings view can be seen here if you rather prefer having this additionally as well.

There are also battle tested packages available for Go (i.e. go-oidc, oidc and others).

PS: I hope you're aware, that your work on wakapi is much appreciated! :raised_hands:

muety commented 1 year ago

Hi @alexanderadam, thanks a lot for your feedback! I'm glad you like Wakapi :pray:.

Please note that this ticket only refers to authenticating against WakaTime's API (required for data import and heartbeats relaying) using OAuth 2 (instead of having to copy & paste your API token).

OAuth 2 / OIDC authentication for Wakapi itself is planned as well, see #33. I didn't get to implementing that, yet, because it's quite a big one (requires refactorings to current auth. logic). But I see how it will be a huge benefit for users, so please stay tuned!

alexanderadam commented 1 year ago

Oh, of course! I obviously even commented on the other issue 🫣

Sorry for the confusion 😆

alexanderadam commented 6 months ago

I think that I might've been one of the main causing askers for this issue here.

However, it turns out that I might have an alternative to Wakapi that allows to use OAuth, hence I'll probably not needing this any more.

So if nobody else asks for this, this can be likely be closed.

muety commented 6 months ago

Will keep this open, as both Wakapi -> WakaTime authentication via OAuth as well as OAuth login for Wakapi itself would be beneficial to have imo.

What alternative are you using now?

alexanderadam commented 6 months ago

What alternative are you using now?

It's a self-built one solution. I was mainly looking for something that can be selfhosted and gives a weekly project & branch based overview by day and so far nothing provided that. All the existing solutions seem to have the bad UX that requires clicking through all the days or even by project individually. Unfortunately not even Wakatime itself provides that easy summary.

So my solution is neither beautiful nor will it help somebody else (since it's not openly available [yet]) but it finally solves the issue and therefore the two open issues at Wakapi aren't this relevant for me any more.

Will keep this open

Okay, I'll keep following these issues anyway as I will likely change back once the two issues are fixed and working. But now there's surely far less pressure on my side. :laughing:

muety commented 6 months ago

You could probably also come up with some self-built script that pulls data from Wakapi's API and then construct the type of summaries you want. In that case, you could still benefit from all the plugins, etc.

But now there's surely far less pressure on my side.

Thanks anyways for contributing your ideas! Wish I had more time to work on Wakapi and implement all these "nice-to-have" features.

alexanderadam commented 6 months ago

You could probably also come up with some self-built script that pulls data from Wakapi's API and then construct the type of summaries you want.

It's basically that — it's a simple Rails app that does OAuth via KanIDM and fetches & stores the data directly from Wakatime. I didn't check yet whether Wakapi would work in-place of the Wakatime instance.

Thanks anyways for contributing your ideas! Wish I had more time to work on Wakapi and implement all these "nice-to-have" features.

No pressure. FOSS should be fun and I'd have implemented it myself if it wouldn't be Go.

I'm very grateful that projects like Wakapi exist.

muety commented 6 months ago

I didn't check yet whether Wakapi would work in-place of the Wakatime instance.

If it does, feel free to report back. If your tool is open-source, we could link it in the (about to be created) "Third-party tools" section of our README.

alexanderadam commented 6 months ago

If it does, feel free to report back.

Will do :+1:

If your tool is open-source, we could link it in the (about to be created) "Third-party tools" section of our README.

It's not and it'll probably won't be. It's doing something very similar as Wakapi anyway as it just shows the same data in a different form. So there's no real advantage for most other users. It just saves quite some time depending on the way you work, but it won't give additional features on top otherwise.