Users
Server-side sign-in
The same sign-in flows the frontend SDKs offer, minus anything that needs a browser or a device authenticator. Every call needs your developer API key.
python
decane = DecaneClient(app_id=os.environ["DECANE_APP_ID"], api_key=os.environ["DECANE_API_KEY"])Email code
python
decane.connect_with_email("user@example.com") # emails a 6-digit code
session = decane.verify_email_code("user@example.com", "123456")Phone code
python
decane.connect_with_phone("+2348012345678") # E.164 only
session = decane.verify_phone_code("+2348012345678", "123456")Token exchange
One step each, for a token the user already holds:
python
decane.connect_with_google_token(google_id_token) # a Google ID token
decane.connect_with_kingschat_token(kc_access_token) # a KingsChat access token
decane.connect_with_token(jwt_from_your_issuer, provider_id="prov-1") # custom authThe result
python
session.access_token # a Decane JWT (8 h): verify it, or hand it to the client
session.user_id # stable Decane user id
session.is_new_user # True on the user's first sign-in
session.has_share # False = no wallet yet
session.profile # AuthProfile(name, email, picture) for Google and KingsChat, else NoneThe profile is passed through from the provider and never stored by Decane. decane.get_user(session.access_token) composes in one line when you also want addresses.
Sign-out
python
decane.revoke_access_token(session.access_token)Caveats
- Rate limits. There is no per-IP limit on sign-in, so one server egress IP is fine. OTP attempts are limited to 10 per 15 minutes per email or phone, and code sends to 3 per hour per address.
- Anti-enumeration.
connect_with_emailandconnect_with_phonesucceed whether or not the address is known. Never tell a user an email was not found. - Token renewal. Tokens last 8 hours.
POST /auth/refreshwith a still-valid token returns a fresh one, up to 7 days after sign-in; this package does not wrap it yet. - Not available server-side: the Google redirect flow, the KingsChat popup and passkey sign-in. Signing transactions stays in the client SDKs.