Auth Service Methods
This folder contains the proto definitions for the services in the project.
Auth Service
This service handles user authentication and authorization. It provides endpoints for user registration, login, password reset, and token management.
Features
User registration
User login
Password reset
OTP verification
Each flow such as login, account creation, etc. goes through multiple gRPC calls. Each call generates a new token with specific permissions.
New Account Creation Flow
AuthService provides the following methods to create a new account:
InitiateAccountCreation
VerifyOtp
CreateAccount
Creating an account has the following steps:
Client calls the
InitiateAccountCreationmethod with the email. Response: OTP sent to email, token with no permissions.Token structure:
{ "permissions": [], "requested_permissions": ["CreateAccount"] }Client calls the
VerifyOtpmethod with the OTP. Response: New token withCreateAccountpermission.Token structure:
{ "permissions": ["CreateAccount"], "requested_permissions": [] }Client calls the
CreateAccountmethod with account details. Response: Session token for accessing other services.Token structure:
{ "permissions": ["*"], "requested_permissions": [] }
Login Flow
AuthService provides the following methods for login:
Login
VerifyOtp (for 2FA)
Login steps:
With 2FA enabled:
Client calls
Loginwith email and password.Server validates credentials.
Server sends OTP to user's email and responds with a token.
Token structure:
{ "permissions": [], "requested_permissions": [] }Client calls
VerifyOtpwith the OTP. Response: Session token.Token structure:
{ "permissions": ["*"], "requested_permissions": [] }
Without 2FA:
Client calls
Loginwith email and password.Server validates credentials.
Server responds with a session token.
Password Reset Flow
Methods for password reset:
InitiatePasswordReset
VerifyOtp
ResetPassword
Steps:
Client calls
InitiatePasswordResetwith username.Input:
username: Account username
Response:
success: Booleanmessage: Stringtoken: String for ResetPassword method
Token structure:
{ "permissions": [], "requested_permissions": ["ResetPassword"] }Client calls
VerifyOtpwith token and OTP. Response: New token withResetPasswordpermission if OTP is valid.Token structure:
{ "permissions": ["ResetPassword"], "requested_permissions": [] }Client calls
ResetPasswordwith token and new password.
