Skip to content

Commit

Permalink
fix: persist app ID with session
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnu-deepsource committed Oct 16, 2023
1 parent 968b0ce commit 899a55b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion auth/oauth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (h *Handler) HandleAuthorize(c echo.Context) error {
return err
}

return c.Redirect(302, url)
return c.Redirect(http.StatusTemporaryRedirect, url)
}

func (h *Handler) HandleCallback(c echo.Context) error {
Expand Down
2 changes: 1 addition & 1 deletion auth/oauth/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (s *Service) CreateSession(ctx context.Context, req *contract.CallbackReque
return nil, httperror.ErrUnknown(err) // TODO: Handle upstream error types.
}

session, err := s.sessionService.CreateSession(token)
session, err := s.sessionService.CreateSession(req.AppID, token)
if err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion auth/session/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ func NewService(runner *common.Runner, deepsource *common.DeepSource, sessionSto
}
}

func (s *Service) CreateSession(token interface{}) (*Session, error) {
func (s *Service) CreateSession(appID string, token interface{}) (*Session, error) {
session := NewSession()
if err := session.SetBackendToken(token); err != nil {
return nil, fmt.Errorf("failed to set backend token, %w", err)
}

session.AppID = appID

if err := session.SetRunnerToken(s.Runner); err != nil {
return nil, fmt.Errorf("failed to set runner token, %w", err)
}
Expand Down

0 comments on commit 899a55b

Please sign in to comment.