This commit is contained in:
2021-11-17 16:40:26 +01:00
parent 164d4b19f3
commit e10c384af7
6 changed files with 477 additions and 0 deletions

32
auth/auth.go Normal file
View File

@@ -0,0 +1,32 @@
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) {
}