Skip to content

Commit

Permalink
Merge pull request #43 from Flajt/fix-HandleNewKey
Browse files Browse the repository at this point in the history
Fix handle new key
  • Loading branch information
Flajt committed Oct 20, 2023
2 parents 4a00139 + e8c9892 commit f1ea46e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion get_new_key/getNewKey.go → get_new_key/get_new_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ func HandleGetNewKey(w http.ResponseWriter, r *http.Request) {
if success {
log.Info().Msg("Valid App Check token,adding api key to response")
w.WriteHeader(http.StatusOK)
w.Write([]byte(apiKeys[1]))
if len(apiKeys) == 1 {
w.Write([]byte(apiKeys[0]))
} else if len(apiKeys) == 2 {
w.Write([]byte(apiKeys[1]))
} else {
log.Debug().Msgf("%d api keys found", len(apiKeys))
panic("Invalid number of api keys found!")
}
return
} else {
log.Error().Msg("Invalid App Check token")
Expand Down

0 comments on commit f1ea46e

Please sign in to comment.