feat(api|runtime): add an AuthenticateProvider registry - #2543
Open
flaviofernandes004 wants to merge 7 commits into
Open
feat(api|runtime): add an AuthenticateProvider registry#2543flaviofernandes004 wants to merge 7 commits into
flaviofernandes004 wants to merge 7 commits into
Conversation
flaviofernandes004
force-pushed
the
ff-auth
branch
from
August 21, 2026 11:06
9f52e32 to
2fea29b
Compare
flaviofernandes004
force-pushed
the
ff-auth
branch
from
August 21, 2026 12:09
2fea29b to
506b62a
Compare
flaviofernandes004
force-pushed
the
ff-auth
branch
from
August 21, 2026 16:41
d9bf38a to
6a5f7e3
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an AuthenticateProvider registry with provider-agnostic authentication, identity linking, persistence, runtime integrations, and console support.
Changes:
- Adds provider registration, hooks, and runtime APIs.
- Adds provider identity authentication, linking, unlinking, and account exposure.
- Updates migrations, protobufs, generated bindings, dependencies, documentation, and console assets.
Reviewed changes
Copilot reviewed 33 out of 53 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Final review |
|---|---|
vendor/modules.txt |
No final findings. |
vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go |
No final findings. |
vendor/github.com/heroiclabs/nakama-common/api/api.proto |
No final findings. |
server/runtime.go |
No final findings. |
server/runtime_lua.go |
No final findings. |
server/runtime_lua_nakama.go |
No final findings. |
server/runtime_lua_match_core.go |
No final findings. |
server/runtime_javascript.go |
No final findings. |
server/runtime_javascript_nakama.go |
No final findings. |
server/runtime_javascript_match_core.go |
No final findings. |
server/runtime_javascript_init.go |
No final findings. |
server/runtime_go.go |
No final findings. |
server/runtime_go_nakama.go |
No final findings. |
server/core_wallet_test.go |
No final findings. |
server/core_unlink.go |
No final findings. |
server/core_link.go |
No final findings. |
server/core_authenticate.go |
No final findings. |
server/core_account.go |
No final findings. |
server/console_unlink.go |
No final findings. |
server/console_runtime.go |
No final findings. |
server/console_config.go |
No final findings. |
server/console_audit.go |
No final findings. |
server/console_account.go |
No final findings. |
server/authenticate_provider_registry.go |
No final findings. |
server/api.go |
No final findings. |
server/api_unlink.go |
No final findings. |
server/api_link.go |
No final findings. |
server/api_authenticate.go |
No final findings. |
migrate/sql/20260819141500-add-user-provider.sql |
No final findings. |
go.sum |
No final findings. |
go.mod |
No final findings. |
console/ui/dist/index.html |
No final findings. |
console/console.swagger.json |
No final findings. |
console/console.proto |
No final findings. |
console/console_grpc.pb.go |
No final findings. |
console/acl/acl.go |
No final findings. |
CHANGELOG.md |
No final findings. |
apigrpc/apigrpc.swagger.json |
Moderate (2 votes): Regenerate the schema to include apiAccount.providers and apiAccountProviderIdentity. |
apigrpc/apigrpc.proto |
No final findings. |
apigrpc/apigrpc.pb.go |
No final findings. |
apigrpc/apigrpc_grpc.pb.go |
No final findings. |
Files not reviewed (3)
- apigrpc/apigrpc.pb.go: Generated file
- apigrpc/apigrpc_grpc.pb.go: Generated file
- console/console_grpc.pb.go: Generated file
Suppressed comments (5)
apigrpc/apigrpc.swagger.json:4133
- The generated OpenAPI description still says this payload is used only with
authenticate, butLinkProviderandUnlinkProvideralso acceptapi.AccountProvider. This makes the public API documentation contradict both the proto comment and the newly exposed endpoints; regenerate or update the schema description to mention all three operations.
"description": "Send credentials for a runtime-registered authentication provider. Used with authenticate."
server/core_link.go:114
LinkProviderdoes not reject an empty provider name before lowercasing and looking it up. A malformed link request therefore returnsNotFound(or reaches an empty-name lookup) instead of theInvalidArgumentvalidation used byAuthenticateProviderandUnlinkProvider, making bad input indistinguishable from an unregistered provider. Validate the required name before the registry lookup.
server/runtime.go:373- These fields advertise Lua/JavaScript provider registries, but registration is exposed only through the Go
Initializer.RegisterAuthenticateProviderimplementation and onlyGoAuthenticateProvidersis populated (runtime.go:2906-2910). Consequently everyRuntimeInforesponse reports empty Lua/JavaScript provider lists; remove those fields or add the corresponding registration and population plumbing before exposing them.
server/runtime_javascript_nakama.go:1898 GetAccount,GetAccounts, and account import now return provider identities, but the sharedaccountToJsObjectconversion still omitsaccount.Providers. Therefore JavaScript runtime account APIs and imports silently drop the linked identities introduced by this feature. Include the providers array (with the corresponding provider user ID field) in this conversion.
server/runtime_lua_nakama.go:2181- The new provider identities are loaded into
api.Account, but the Lua account serializers (accountGetId,accountsGetId, and account import) still only copy devices, custom IDs, and the legacy fields; they never emitaccount.Providers. As a result Lua code cannot observe identities linked through this provider API. Add aproviderstable containing each provider and provider user ID in all of those account conversions.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+4114
to
+4118
| "apiAccountProvider": { | ||
| "type": "object", | ||
| "properties": { | ||
| "provider": { | ||
| "type": "string", |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 33 out of 53 changed files in this pull request and generated 3 comments.
Files not reviewed (3)
- apigrpc/apigrpc.pb.go: Generated file
- apigrpc/apigrpc_grpc.pb.go: Generated file
- console/console_grpc.pb.go: Generated file
Suppressed comments (4)
apigrpc/apigrpc.swagger.json:4133
- The generated OpenAPI schema is incomplete for the new account field:
apiAccounthas noprovidersproperty and there is noapiAccountProviderIdentitydefinition, even though the API now returns linked provider identities. Clients generated from this spec will not discover that response data; regenerate the artifact from the updated common API proto. The description here also incorrectly says this request is used only with authenticate, while the new link and unlink routes use it too.
"description": "Send credentials for a runtime-registered authentication provider. Used with authenticate."
server/core_account.go:164
- Although
GetAccountnow fills the publicapi.Account.Providersfield, the Lua and JavaScript account adapters still omit this field (accountGetId,accountsGetId, and import results). Scripts using those APIs therefore see no linked provider identities, while Go/API/console consumers do. Add the provider arrays to each adapter using its existing snake_case/camelCase conversion conventions.
server/runtime_javascript_nakama.go:2599 GetAccountandGetAccountsnow populateAccount.Providers, but the JavaScript account conversion used byaccountGetId,accountsGetId, andaccountImportIdnever copies that field. JavaScript runtime callers consequently cannot see linked provider identities; add the provider array to this conversion using the JavaScript field names.
server/runtime_lua_nakama.go:3314- The Lua account serializers for
account_get_id,accounts_get_id, andaccount_import_idomitaccount.Providers, even though the underlying account lookups now populate it. Lua callers therefore cannot inspect linked provider identities, unlike Go and the public account API; add aproviderstable to each account conversion.
| } | ||
| providerID = strings.ToLower(providerID) | ||
|
|
||
| err := ExecuteInTx(ctx, db, func(tx *sql.Tx) error { |
Comment on lines
+273
to
+275
| if err != nil { | ||
| return nil, err, code | ||
| } |
| return "", err | ||
| } | ||
|
|
||
| globalFnId, err := im.getRegisteredFnIdentifier(r, bs, initFnVarName, providerName, "registerAuthenticateProvider") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.