good commit
This commit is contained in:
89
README.md
89
README.md
@@ -1,59 +1,68 @@
|
||||
# AuthService
|
||||
# Telegram UserAuth UI
|
||||
|
||||
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.0.4.
|
||||
Reusable Angular-hosted UI for the Telegram login dialog.
|
||||
|
||||
## Development server
|
||||
The app now contains a single standalone page based on the extracted dialog design. It preserves the same visual states and the same state-switcher behavior from the provided HTML:
|
||||
|
||||
To start a local development server, run:
|
||||
- `ready`
|
||||
- `loading`
|
||||
- `checking`
|
||||
- `expired`
|
||||
- `error`
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
ng serve
|
||||
npm start
|
||||
```
|
||||
|
||||
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
|
||||
The dev server runs on port `4300`.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
||||
## Build
|
||||
|
||||
```bash
|
||||
ng generate component component-name
|
||||
npm run build
|
||||
```
|
||||
|
||||
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
||||
## Backend contract
|
||||
|
||||
```bash
|
||||
ng generate --help
|
||||
This UI is intended to work against a reusable Telegram auth backend with these endpoints:
|
||||
|
||||
- `GET /userauth/session`
|
||||
- `POST /userauth/qr/create`
|
||||
- `GET /userauth/qr/poll?token=...`
|
||||
- `POST /userauth/qr/confirm`
|
||||
- `GET /userauth/telegram/callback`
|
||||
- `POST /userauth/logout`
|
||||
- `POST /usersession/{sessionId}`
|
||||
|
||||
Expected authenticated session payload:
|
||||
|
||||
```json
|
||||
{
|
||||
"sessionId": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"telegramUserId": 123456789,
|
||||
"username": "ivan_petrov",
|
||||
"displayName": "Ivan Petrov",
|
||||
"active": true,
|
||||
"expiresAt": "2026-05-21T14:30:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
## Building
|
||||
Runtime expectations preserved by the UI:
|
||||
|
||||
To build the project run:
|
||||
- QR polling every 3 seconds
|
||||
- QR expiry after 100 checks on the frontend
|
||||
- direct Telegram login button support
|
||||
- fallback session re-check if QR creation fails
|
||||
|
||||
```bash
|
||||
ng build
|
||||
```
|
||||
Cookie requirements expected by consumers:
|
||||
|
||||
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
|
||||
- name: `userauth_session`
|
||||
- path: `/`
|
||||
- `HttpOnly: true`
|
||||
- `Secure: true`
|
||||
- `SameSite: None`
|
||||
- `MaxAge: 86400`
|
||||
|
||||
## Running unit tests
|
||||
|
||||
To execute unit tests with the [Vitest](https://vitest.dev/) test runner, use the following command:
|
||||
|
||||
```bash
|
||||
ng test
|
||||
```
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
For end-to-end (e2e) testing, run:
|
||||
|
||||
```bash
|
||||
ng e2e
|
||||
```
|
||||
|
||||
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
||||
Credentialed CORS is required on the backend.
|
||||
|
||||
Reference in New Issue
Block a user