diff --git a/handlers/google_auth.go b/handlers/google_auth.go index 6fd7d0d..5175a04 100644 --- a/handlers/google_auth.go +++ b/handlers/google_auth.go @@ -326,7 +326,12 @@ func GoogleCallback(w http.ResponseWriter, r *http.Request) { helper.LogInfo("Copy this access token: " + accessToken) - RedirectURL := fmt.Sprintf("%s/callback?token=%s&user_id=%s", redirectURI, accessToken, userID) + var RedirectURL string + if strings.Contains(redirectURI, "com.") { //Request from mobile; append refresh_token to query params + RedirectURL = fmt.Sprintf("%s/callback?token=%s&refresh_token=%s&user_id=%s", redirectURI, accessToken, refreshToken, userID) + } + + RedirectURL = fmt.Sprintf("%s/callback?token=%s&user_id=%s", redirectURI, accessToken, userID) http.Redirect(w, r, RedirectURL, http.StatusSeeOther) }