@@ -38,7 +38,7 @@ func loginCmd() *cobra.Command {
38
38
Short : "Login to devbox" ,
39
39
Args : cobra .ExactArgs (0 ),
40
40
RunE : func (cmd * cobra.Command , args []string ) error {
41
- c , err := auth . NewClient ( build . Issuer (), build . ClientID (), scopes )
41
+ c , err := newAuthClient ( )
42
42
if err != nil {
43
43
return err
44
44
}
@@ -60,7 +60,7 @@ func logoutCmd() *cobra.Command {
60
60
Short : "Logout from devbox" ,
61
61
Args : cobra .ExactArgs (0 ),
62
62
RunE : func (cmd * cobra.Command , args []string ) error {
63
- c , err := auth . NewClient ( build . Issuer (), build . ClientID (), scopes )
63
+ c , err := newAuthClient ( )
64
64
if err != nil {
65
65
return err
66
66
}
@@ -110,9 +110,18 @@ func whoAmICmd() *cobra.Command {
110
110
}
111
111
112
112
func genSession (ctx context.Context ) (* session.Token , error ) {
113
- c , err := auth . NewClient ( build . Issuer (), build . ClientID (), scopes )
113
+ c , err := newAuthClient ( )
114
114
if err != nil {
115
115
return nil , err
116
116
}
117
117
return c .GetSession (ctx )
118
118
}
119
+
120
+ func newAuthClient () (* auth.Client , error ) {
121
+ return auth .NewClient (
122
+ build .Issuer (),
123
+ build .ClientID (),
124
+ scopes ,
125
+ build .SuccessRedirect (),
126
+ )
127
+ }
0 commit comments