Authentication
NeoSC API supports multiple authentication methods:- Email/Password - Traditional registration and login
- SSO via Zitadel - OIDC-based single sign-on
- Token-based - Bearer token authentication
Authentication Flow
- Register a new user or login with existing credentials
- Receive an access token in the response
- Include the token in the
Authorizationheader for all subsequent requests
Register User
Request Body
User’s email address (must be unique)
User’s password (will be hashed using SHA-256)
User’s full name
Organization name (defaults to “Default Organization”)
Response
Bearer token for authentication (32-byte URL-safe token)
Always “bearer”
User object containing profile information
Response Example
Login
Request Body
User’s email address
User’s password
Response
Returns the sameAuthToken structure as registration.
Error Responses
Invalid credentials - Email not found or password incorrect
SSO Login (Zitadel OIDC)
Request Body
Zitadel access token from OIDC flow
OIDC user profile containing email, name, sub, etc.
SSO provider name (defaults to “zitadel”)
User roles from Zitadel (admin role auto-detected)
User groups from Zitadel
Optional OIDC ID token
Role Detection
The API automatically assigns theadmin role if:
- Any role contains “admin”, “administrator”, or equals “owner”
- Any group contains “admin”
user role is assigned.
Token Exchange
Exchange an authorization code for tokens (used to avoid CORS issues).Request Body
Authorization code from OIDC flow
PKCE code verifier
OAuth redirect URI
“zitadel_onprem” or “zitadel_cloud” (defaults to “zitadel_onprem”)
Optional Zitadel authority URL override
Optional client ID override
Get Current User
Retrieve the currently authenticated user’s profile.Response
Get Current User
Retrieve the profile of the currently authenticated user.Response
Returns the authenticated user’s profile:This endpoint is useful for validating tokens and retrieving user information for the frontend.
Logout
Invalidate the current authentication token.Response
Using the Token
Include the access token in all authenticated requests:Token Format
Tokens are 32-byte URL-safe strings generated using Python’ssecrets.token_urlsafe(32).
Error Responses
Email already registered (for registration)
Not authenticated - Missing or invalid Authorization header
Invalid token - Token not found in active tokens
Invalid credentials - Wrong email or password
Failed to connect to Zitadel (for SSO/token exchange)