In a new project, I need to handle Gitlab OAuth2 from CLI and I was happy to find your lib. I add support for Gitlab that does not supporturn:ietf:wg:oauth:2.0:oob redirect URI so I also add a redirect_uri parameter to AuthFlow.auth_code().
Furthermore, I don't want to store tokens in my case and I think it's could be great to have possibilty to store tokens in a more secure way. So, I create a modular way to store token: I keep your method as default and adding two new storage backends:
Hello,
In a new project, I need to handle Gitlab OAuth2 from CLI and I was happy to find your lib. I add support for Gitlab that does not support
urn:ietf:wg:oauth:2.0:oob
redirect URI so I also add aredirect_uri
parameter toAuthFlow.auth_code()
.Furthermore, I don't want to store tokens in my case and I think it's could be great to have possibilty to store tokens in a more secure way. So, I create a modular way to store token: I keep your method as default and adding two new storage backends:
NoneStorage
: disable storageKeryingStorage
: use keyring lib to store tokenTo use one of them, we just have to provide one instance of them by using the
tokens_storage
parameter of the provider:The storage backend constructor allow to customize their behaviour, so I add some parameters:
path
parameter toConfigFileStorage
to change the default storage path (~/.config/PythonCliAuth/tokens.json
)service_name
parameter toKeyringStorage
to change the default service name (python-cli-oauth2
)Edit: I also added Forgejo auth provider too. It may be also compatible with Gitea.