SpotifyGo/auth/auth.go
2021-11-17 16:40:26 +01:00

33 lines
608 B
Go

package SpotifyGoAuth
import (
"os"
"golang.org/x/oauth2"
)
type SpotifyAuthenticator struct {
config *oauth2.Config
}
func CreateAuthenticator() (SpotifyAuthenticator, error) {
oauth := oauth2.Config{
ClientID: os.Getenv("SPOTIFY_ID"),
ClientSecret: os.Getenv("SPOTIFY_SECRET"),
Endpoint: oauth2.Endpoint{
AuthURL: "https://accounts.spotify.com/authorize",
TokenURL: "https://accounts.spotify.com/api/token",
},
}
authenticator := SpotifyAuthenticator{
config: &oauth,
}
return authenticator, nil
}
func (auth SpotifyAuthenticator) generateAuthURL() (string, error) {
}