parent
4266154749
commit
39d0f1de98
4
oauth.go
4
oauth.go
|
@ -113,12 +113,14 @@ func (h oauthHandler) viewOauthCallback(w http.ResponseWriter, r *http.Request)
|
||||||
|
|
||||||
err := h.DB.ValidateOAuthState(ctx, state)
|
err := h.DB.ValidateOAuthState(ctx, state)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("Unable to ValidateOAuthState: %s", err)
|
||||||
failOAuthRequest(w, http.StatusInternalServerError, err.Error())
|
failOAuthRequest(w, http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tokenResponse, err := h.exchangeOauthCode(ctx, code)
|
tokenResponse, err := h.exchangeOauthCode(ctx, code)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("Unable to exchangeOauthCode: %s", err)
|
||||||
failOAuthRequest(w, http.StatusInternalServerError, err.Error())
|
failOAuthRequest(w, http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -127,12 +129,14 @@ func (h oauthHandler) viewOauthCallback(w http.ResponseWriter, r *http.Request)
|
||||||
// it really really works.
|
// it really really works.
|
||||||
tokenInfo, err := h.inspectOauthAccessToken(ctx, tokenResponse.AccessToken)
|
tokenInfo, err := h.inspectOauthAccessToken(ctx, tokenResponse.AccessToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("Unable to inspectOauthAccessToken: %s", err)
|
||||||
failOAuthRequest(w, http.StatusInternalServerError, err.Error())
|
failOAuthRequest(w, http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
localUserID, err := h.DB.GetIDForRemoteUser(ctx, tokenInfo.UserID)
|
localUserID, err := h.DB.GetIDForRemoteUser(ctx, tokenInfo.UserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error("Unable to GetIDForRemoteUser: %s", err)
|
||||||
failOAuthRequest(w, http.StatusInternalServerError, err.Error())
|
failOAuthRequest(w, http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue