Browse Source

Use non-panicking type assertion

kegan/github-auth
Kegan Dougal 9 years ago
parent
commit
f15afa4780
  1. 6
      src/github.com/matrix-org/go-neb/realms/github/github.go

6
src/github.com/matrix-org/go-neb/realms/github/github.go

@ -96,7 +96,11 @@ func (r *githubRealm) OnReceiveRedirect(w http.ResponseWriter, req *http.Request
failWith(logger, w, 400, "Provided ?state= param is not recognised.", err) failWith(logger, w, 400, "Provided ?state= param is not recognised.", err)
return return
} }
ghSession := session.(*githubSession)
ghSession, ok := session.(*githubSession)
if !ok {
failWith(logger, w, 500, "Unexpected session found.", nil)
return
}
logger.WithField("user_id", ghSession.UserID()).Print("Mapped redirect to user") logger.WithField("user_id", ghSession.UserID()).Print("Mapped redirect to user")
// exchange code for access_token // exchange code for access_token

Loading…
Cancel
Save