Fix OAuth2
authorMikael Berthe <mikael@lilotux.net>
Wed, 01 Nov 2017 10:20:45 +0100
changeset 199 9d9d27e7bad2
parent 198 2dd1ed9394f0
child 200 67bae6c005d9
Fix OAuth2 nil contexts are no more allowed in the oauth2 package. This patch fixes https://github.com/McKael/madonctl/issues/12.
login.go
--- a/login.go	Sat Oct 28 22:43:54 2017 +0200
+++ b/login.go	Wed Nov 01 10:20:45 2017 +0100
@@ -10,6 +10,7 @@
 	"encoding/json"
 	"strings"
 
+	"golang.org/x/net/context"
 	"golang.org/x/oauth2"
 
 	"github.com/pkg/errors"
@@ -117,7 +118,7 @@
 	}
 
 	// Return token
-	t, err := conf.Exchange(nil, code)
+	t, err := conf.Exchange(context.TODO(), code)
 	if err != nil {
 		return "", errors.Wrap(err, "cannot convert code into a token")
 	}