fixed dereferencing of FetchedRedirectURI
This commit is contained in:
@@ -65,7 +65,7 @@ func init() {
|
|||||||
},
|
},
|
||||||
Endpoint: google.Endpoint,
|
Endpoint: google.Endpoint,
|
||||||
}
|
}
|
||||||
|
log.Print("Redirect URL set to: ", googleOauthConfig.RedirectURL)
|
||||||
if googleOauthConfig.ClientID == "" {
|
if googleOauthConfig.ClientID == "" {
|
||||||
log.Fatal("GOOGLE_CLIENT_ID is not set in environment variables")
|
log.Fatal("GOOGLE_CLIENT_ID is not set in environment variables")
|
||||||
}
|
}
|
||||||
@@ -325,8 +325,8 @@ func GoogleCallback(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
helper.LogInfo("Copy this access token: " + accessToken)
|
helper.LogInfo("Copy this access token: " + accessToken)
|
||||||
|
|
||||||
RedirectURI := *FetchedRedirectURI
|
if FetchedRedirectURI != nil && *FetchedRedirectURI != "" {
|
||||||
if RedirectURI != "" {
|
RedirectURI := *FetchedRedirectURI
|
||||||
log.Print("RedirectURI from query param: ", RedirectURI)
|
log.Print("RedirectURI from query param: ", RedirectURI)
|
||||||
if !IsAllowedRedirectURI(RedirectURI) {
|
if !IsAllowedRedirectURI(RedirectURI) {
|
||||||
helper.RespondWithError(w, http.StatusUnauthorized, "Unauthorized RedirectURI")
|
helper.RespondWithError(w, http.StatusUnauthorized, "Unauthorized RedirectURI")
|
||||||
@@ -360,6 +360,7 @@ func validateState(w http.ResponseWriter, r *http.Request) bool {
|
|||||||
|
|
||||||
func FetchGoogleUserInfo(w http.ResponseWriter, r *http.Request) (models.UserGoogleInfo, error) {
|
func FetchGoogleUserInfo(w http.ResponseWriter, r *http.Request) (models.UserGoogleInfo, error) {
|
||||||
code := r.URL.Query().Get("code")
|
code := r.URL.Query().Get("code")
|
||||||
|
log.Print("Authorization code received: ", code)
|
||||||
token, err := googleOauthConfig.Exchange(context.Background(), code)
|
token, err := googleOauthConfig.Exchange(context.Background(), code)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
helper.LogError(err, "Error exchanging token")
|
helper.LogError(err, "Error exchanging token")
|
||||||
|
|||||||
Reference in New Issue
Block a user