Get started
SDKs
Every official SDK is open source under the MIT license and lives in the METANETSOFT GitHub organization. They follow one contract, so method names carry over between languages in each language's naming style: verifySignUp in JavaScript is verify_sign_up in Python and VerifySignUp in Go.
| Language | Repository | Install | Parts |
|---|---|---|---|
| JavaScript / TypeScript | foxloginjsdk | npm install foxlogin |
Client and server |
| Python | foxlogin-python | pip install foxlogin |
Client and server |
| Go | foxlogin-go | go get github.com/METANETSOFT/foxlogin-go |
Client and server |
| PHP | foxlogin-php | composer require metanetsoft/foxlogin |
Client and server |
| Java | foxlogin-java | Maven app.foxlogin:foxlogin |
Client and server |
| .NET | foxlogin-dotnet | dotnet add package FoxLogin |
Client and server |
| Ruby | foxlogin-ruby | gem install foxlogin |
Client and server |
| Rust | foxlogin-rust | cargo add foxlogin |
Client and server |
| Swift | foxlogin-swift | Swift Package Manager github.com/METANETSOFT/foxlogin-swift |
Client |
| Kotlin | foxlogin-kotlin | Maven app.foxlogin:foxlogin-kotlin |
Client |
| Dart | foxlogin-dart | dart pub add foxlogin |
Client |
The client part signs users in with the publishable key. The server part verifies session tokens and calls the Management API with a secret key or an organization API key. The Swift, Kotlin and Dart SDKs run on devices, so they have no server part; your backend uses one of the server SDKs.
JavaScript SDK
One package works in browsers and in Node.js 20 or later. It has two entry points.
foxlogin (browser and app)
| Export | What it does |
|---|---|
new FoxLogin({ publishableKey, storage?, baseUrl?, fetch? }) |
The client. Reads the region from the publishable key and calls https://<region>.auth.foxlogin.app. baseUrl overrides the host for tests. |
signUp, verifySignUp |
Sign-up with an email code. |
signIn, verifyMfa |
Password sign-in and the two-factor step. |
sendSignInCode, signInWithCode |
Email-code sign-in. |
startPasswordReset, confirmPasswordReset |
Password reset by email code. |
getToken, refresh, signOut |
The current access token, a forced refresh, and sign-out. |
user, state, ready(), onChange(listener) |
The signed-in user, the auth state, the promise that resolves once the stored session is loaded, and a change listener that returns an unsubscribe function. |
baseUrl |
The region host the client calls. |
memoryStorage(), localStorageStorage() |
Session storage: memory only (the default) or localStorage. |
FoxLoginError |
The error every failed call throws. |
Google sign-in has no method yet. Sign in with Google shows the calls with fetch, and verifyMfa finishes it for users with two-factor authentication.
foxlogin/server (backend)
| Export | What it does |
|---|---|
verifyToken(token, { applicationId?, jwksUrl?, keys? }) |
Verifies a session token locally and returns its claims. |
new FoxLoginAdmin({ secretKey }) |
Management API client. Takes a secret key (sk_live_…) or an organization API key (fk_live_…); apiKey is the same option. |
admin.applications.create, .list, .get |
Applications. Creating one needs an organization API key. |
admin.users.create, .get |
Users of one application. |
FoxLoginError |
The same error class as on the client. |
For endpoints the SDK does not wrap yet, such as listing users, events and webhooks, call the Management API with fetch and the same key.
FoxLoginAdmin accepts secret keys from version 0.3.1. Older versions accept only organization keys.