This OAuthMiddleware enable OAuth2 based authentication for a Grocy instance.
Note: This is not an official part of Grocy. Please report issues here and NOT in the Grocy repo.
This was only tested against authentik but it should work with any OAuth2 provider.
OAuthMiddleware.php
to the Grocy root at middleware/OAuthMiddleware.php
config.php
and adapt to your setup:
Setting('AUTH_CLASS', 'Grocy\Middleware\OAuthMiddleware');
// Options when using OAuthMiddleware Setting('OAUTH_CLIENT_ID', ''); Setting('OAUTH_CLIENT_SECRET', ''); Setting('OAUTH_SCOPES', 'openid profile'); Setting('OAUTH_USERNAME_CLAIM', 'preferred_username'); Setting('OAUTH_AUTH_URL', ''); Setting('OAUTH_TOKEN_URL', ''); Setting('OAUTH_USERINFO_URL', '');