(w http.ResponseWriter, r *http.Request)
| 145 | } |
| 146 | |
| 147 | func (a *app) handleCallback(w http.ResponseWriter, r *http.Request) { |
| 148 | token := r.URL.Query().Get("t") |
| 149 | |
| 150 | defer func() { |
| 151 | a.serverChan <- nil |
| 152 | }() |
| 153 | |
| 154 | if token == "" { |
| 155 | w.WriteHeader(http.StatusExpectationFailed) |
| 156 | return |
| 157 | } |
| 158 | |
| 159 | if err := saveAuthToken(token); err != nil { |
| 160 | w.WriteHeader(http.StatusInternalServerError) |
| 161 | return |
| 162 | } |
| 163 | |
| 164 | logger.Info().Msg("login successful!") |
| 165 | fmt.Fprintln(w, "login successful, you can now close this window and go back to the terminal") |
| 166 | } |
| 167 | |
| 168 | func openbrowser(url string) error { |
| 169 | var cmd *exec.Cmd |
nothing calls this directly
no test coverage detected