Skip to content

Passing Authentication Method to After Authenticate Functions [HIRO-385]#157

Open
tolgatolgay wants to merge 1 commit into
mainfrom
tt/after-auth-updates
Open

Passing Authentication Method to After Authenticate Functions [HIRO-385]#157
tolgatolgay wants to merge 1 commit into
mainfrom
tt/after-auth-updates

Conversation

@tolgatolgay
Copy link
Copy Markdown
Contributor

No description provided.

@tolgatolgay tolgatolgay changed the title Passing Authentication Method to After Authenticate Functions Passing Authentication Method to After Authenticate Functions [HIRO-385] May 21, 2026
@linear
Copy link
Copy Markdown

linear Bot commented May 21, 2026

HIRO-385

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends Hiro’s authentication-related hooks to include the authentication provider, so downstream “after authenticate” handlers and publishers can react differently based on the login method (Apple/Google/etc.).

Changes:

  • Extend Publisher.Authenticate to include an AuthProvider argument.
  • Extend AfterAuthenticateFn to include an AuthProvider argument.
  • Introduce the AuthProvider type and constants, and update SatoriPersonalizer to match the updated publisher interface.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
publisher.go Adds provider AuthProvider to the Publisher.Authenticate interface method.
personalizer_satori.go Updates SatoriPersonalizer.Authenticate signature to implement the updated Publisher interface.
base.go Adds AuthProvider type/constants and extends AfterAuthenticateFn to include the provider.
Comments suppressed due to low confidence (1)

personalizer_satori.go:246

  • The new provider parameter (and created) are not used in this implementation. If they’re intentionally unused, consider renaming them to _ (or otherwise documenting why they’re unused) to avoid confusion for readers and to make it clear Satori auth does not currently depend on the auth provider.
func (p *SatoriPersonalizer) Authenticate(ctx context.Context, logger runtime.Logger, nk runtime.NakamaModule, userID string, created bool, provider AuthProvider) {
	if !p.IsPublishAuthenticateRequest() && !p.IsPublishAuthenticateRequestWithSession() {
		return
	}
	if _, err := nk.GetSatori().Authenticate(ctx, userID, nil, nil, !p.IsPublishAuthenticateRequestWithSession()); err != nil && !errors.Is(err, runtime.ErrSatoriConfigurationInvalid) {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread publisher.go
@@ -48,7 +48,7 @@ type PublisherEvent struct {
type Publisher interface {
// Authenticate is called every time a user authenticates with Hiro. The 'created' flag is true if this
// is a newly created user account, and each implementation may choose to handle this as it chooses.
Comment thread base.go
Comment on lines +74 to 75
type AfterAuthenticateFn func(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, session *api.Session, provider AuthProvider) error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants