methics / laverca-csc-client

Laverca CSC client is a simple Java client for CSC v1.0.4.0 API
https://methics.github.io/laverca-csc-client/
Apache License 2.0
6 stars 0 forks source link

Feature Request: Inject access and refresh tokens retrieved via different channel #7

Open mkl-public opened 2 months ago

mkl-public commented 2 months ago

Currently the only way to authenticate is by means of CscClient.authLogin() via /csc/v1/auth/login. But the CSC API also allows for different ways to retrieve access and refresh tokens.

Thus, I'd propose adding an alternative method to inject tokens retrieved via a different channel, e.g. a CscClient.useTokens(String accessToken, String refreshToken) that simply sets the access_token and refresh_token members to the given values.

If some sanity check is desired, either token may be null (for connections without refresh-feature or connections that first of all have to call refreshLogin()) but not both concurrently.

Hemuu commented 2 months ago

This sounds like a good idea. Will look into it at some point. PR is of course welcome!