Use config from OAuth2Authenticator for auth command

This commit is contained in:
Philipp Wolfer 2023-11-22 08:41:18 +01:00
parent cf3747bde2
commit d0739aad0f
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
5 changed files with 31 additions and 18 deletions

View file

@ -17,6 +17,7 @@ Scotty. If not, see <https://www.gnu.org/licenses/>.
package models
import (
"net/url"
"time"
"github.com/spf13/viper"
@ -83,9 +84,11 @@ type LovesImport interface {
// Must be implemented by backends requiring OAuth2 authentication
type OAuth2Authenticator interface {
Backend
// Returns OAuth2 config suitable for this backend
OAuth2Config(redirectUrl string) oauth2.Config
OAuth2Config(redirectUrl *url.URL) oauth2.Config
// Setup the OAuth2 client
OAuth2Setup(redirectUrl string, token *oauth2.Token) error
OAuth2Setup(redirectUrl *url.URL, token *oauth2.Token) error
}