You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It wasn't working before because the default redirectURI in the Config had been changed.
cli is a predefined client in arduino authentication system that requires a certain redirectURI.
Changing the redirectURI means you have to change the ClientID as well.
Now the tests are run providing -user and -pass flags, in order not to leak passwords when the arduino-cli will be made public.
Copy file name to clipboardExpand all lines: auth/auth.go
+59-48
Original file line number
Diff line number
Diff line change
@@ -27,21 +27,19 @@
27
27
* Copyright 2017 BCMI LABS SA (http://www.arduino.cc/)
28
28
*/
29
29
30
-
/*
31
-
Package auth uses the `oauth2 authorization_code` flow to authenticate with Arduino
32
-
33
-
If you have the username and password of a user, you can just instantiate a client with sane defaults:
34
-
35
-
client := auth.New()
36
-
37
-
and then call the Token method to obtain a Token object with an AccessToken and a RefreshToken
38
-
39
-
token, err := client.Token(username, password)
40
-
41
-
If instead you already have a token but want to refresh it, just call
42
-
43
-
token, err := client.refresh(refreshToken)
44
-
*/
30
+
// Package auth uses the `oauth2 authorization_code` flow to authenticate with Arduino
31
+
//
32
+
// If you have the username and password of a user, you can just instantiate a client with sane defaults:
33
+
//
34
+
// client := auth.New()
35
+
//
36
+
// and then call the Token method to obtain a Token object with an AccessToken and a RefreshToken
37
+
//
38
+
// token, err := client.Token(username, password)
39
+
//
40
+
// If instead you already have a token but want to refresh it, just call
41
+
//
42
+
// token, err := client.refresh(refreshToken)
45
43
package auth
46
44
47
45
import (
@@ -56,17 +54,53 @@ import (
56
54
"github.com/pkg/errors"
57
55
)
58
56
57
+
// Config contains the variables you may want to change
58
+
typeConfigstruct {
59
+
// CodeURL is the endpoint to redirect to obtain a code
60
+
CodeURLstring
61
+
62
+
// TokenURL is the endpoint where you can request an access code
63
+
TokenURLstring
64
+
65
+
// ClientID is the client id you are using
66
+
ClientIDstring
67
+
68
+
// RedirectURI is the redirectURI where the oauth process will redirect. It's only required since the oauth system checks for it, but we intercept the redirect before hitting it
69
+
RedirectURIstring
70
+
71
+
// Scopes is a space-separated list of scopes to require
72
+
Scopesstring
73
+
}
74
+
59
75
// New returns an auth configuration with sane defaults
0 commit comments