@@ -38,7 +38,7 @@ func loginCmd() *cobra.Command {
3838 Short : "Login to devbox" ,
3939 Args : cobra .ExactArgs (0 ),
4040 RunE : func (cmd * cobra.Command , args []string ) error {
41- c , err := auth . NewClient ( build . Issuer (), build . ClientID (), scopes )
41+ c , err := newAuthClient ( )
4242 if err != nil {
4343 return err
4444 }
@@ -60,7 +60,7 @@ func logoutCmd() *cobra.Command {
6060 Short : "Logout from devbox" ,
6161 Args : cobra .ExactArgs (0 ),
6262 RunE : func (cmd * cobra.Command , args []string ) error {
63- c , err := auth . NewClient ( build . Issuer (), build . ClientID (), scopes )
63+ c , err := newAuthClient ( )
6464 if err != nil {
6565 return err
6666 }
@@ -110,9 +110,18 @@ func whoAmICmd() *cobra.Command {
110110}
111111
112112func genSession (ctx context.Context ) (* session.Token , error ) {
113- c , err := auth . NewClient ( build . Issuer (), build . ClientID (), scopes )
113+ c , err := newAuthClient ( )
114114 if err != nil {
115115 return nil , err
116116 }
117117 return c .GetSession (ctx )
118118}
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