Checking authentication on the backend

This commit is contained in:
2024-08-19 21:39:36 +02:00
parent a9ab175407
commit 7ef68d030b
5 changed files with 38 additions and 2 deletions

View File

@ -297,3 +297,7 @@ func (app *application) CreateAuthToken(w http.ResponseWriter, r *http.Request)
_ = app.writeJSON(w, http.StatusOK, payload)
}
func (app *application) CheckAuthentication(w http.ResponseWriter, r *http.Request) {
app.invalidCredentials(w)
}

View File

@ -23,6 +23,7 @@ func (app *application) routes() http.Handler {
mux.Post("/api/create-customer-and-subscribe-to-plan", app.CreateCustomerAndSubscribeToPlan)
mux.Post("/api/authenticate", app.CreateAuthToken)
mux.Post("/api/is-authenticated", app.CheckAuthentication)
return mux
}