{"id":36980200,"url":"https://github.com/aslnbxrz/oneid","last_synced_at":"2026-01-13T22:49:52.554Z","repository":{"id":316879519,"uuid":"1065134897","full_name":"aslnbxrz/oneid","owner":"aslnbxrz","description":"Professional OneID integration package for Laravel - Uzbekistan's unified identification system","archived":false,"fork":false,"pushed_at":"2025-09-27T09:36:17.000Z","size":104,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-27T10:26:22.642Z","etag":null,"topics":["authentication","egov","identity","laravel","oauth","oneid","sso","uzbekistan"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/aslnbxrz/oneid","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aslnbxrz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-27T05:59:28.000Z","updated_at":"2025-09-27T09:33:29.000Z","dependencies_parsed_at":"2025-09-28T15:01:34.949Z","dependency_job_id":null,"html_url":"https://github.com/aslnbxrz/oneid","commit_stats":null,"previous_names":["aslnbxrz/oneid"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/aslnbxrz/oneid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aslnbxrz%2Foneid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aslnbxrz%2Foneid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aslnbxrz%2Foneid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aslnbxrz%2Foneid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aslnbxrz","download_url":"https://codeload.github.com/aslnbxrz/oneid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aslnbxrz%2Foneid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","egov","identity","laravel","oauth","oneid","sso","uzbekistan"],"created_at":"2026-01-13T22:49:51.817Z","updated_at":"2026-01-13T22:49:52.549Z","avatar_url":"https://github.com/aslnbxrz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OneID Laravel Package\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/aslnbxrz/oneid.svg?style=flat-square)](https://packagist.org/packages/aslnbxrz/oneid)\n[![Total Downloads](https://img.shields.io/packagist/dt/aslnbxrz/oneid.svg?style=flat-square)](https://packagist.org/packages/aslnbxrz/oneid)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/aslnbxrz/oneid/tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/aslnbxrz/oneid/actions)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nProfessional Laravel package for integrating with **OneID** - Uzbekistan's unified identification system (Yagona identifikatsiya tizimi). This package provides a clean, secure, and easy-to-use interface for OneID authentication in Laravel applications.\n\n## 🚀 Features\n\n- **Easy Integration**: Simple setup and configuration\n- **Flexible Routes**: Use built-in routes or create your own\n- **Facade Support**: Clean facade interface for easy usage\n- **Comprehensive Configuration**: Extensive configuration options\n- **Error Handling**: Robust error handling and logging\n- **Security**: Built-in security features and validation\n- **Laravel 10+ Support**: Compatible with modern Laravel versions\n- **Testing**: Comprehensive test suite included\n\n## 📋 Requirements\n\n- PHP 8.2 or higher\n- Laravel 10.0 or higher\n- Valid OneID application credentials\n\n## 📦 Installation\n\nYou can install the package via Composer:\n\n```bash\ncomposer require aslnbxrz/oneid\n```\n\n## ⚙️ Configuration\n\n### 1. Publish Configuration\n\nPublish the configuration file:\n\n```bash\nphp artisan vendor:publish --provider=\"Aslnbxrz\\OneId\\OneIdServiceProvider\" --tag=\"oneid-config\"\n```\n\n### 2. Environment Variables\n\nAdd the following environment variables to your `.env` file:\n\n```env\n# OneID Configuration\nONEID_BASE_URL=https://sso.egov.uz\nONEID_CLIENT_ID=your_client_id\nONEID_CLIENT_SECRET=your_client_secret\nONEID_SCOPE=openid profile\nONEID_REDIRECT_URI=https://your-app.com/auth/oneid/callback\n\n# Optional: Route Configuration\nONEID_ROUTES_ENABLED=true\nONEID_ROUTE_PREFIX=auth/oneid\nONEID_ROUTE_MIDDLEWARE=web\n\n# Optional: Logging Configuration\nONEID_LOGGING_ENABLED=true\nONEID_LOG_LEVEL=info\nONEID_LOG_CHANNEL=default\n\n# Optional: Security Configuration\nONEID_VERIFY_SSL=true\nONEID_RATE_LIMITING_ENABLED=true\nONEID_RATE_LIMIT_ATTEMPTS=5\nONEID_RATE_LIMIT_DECAY=1\n```\n\n### 3. OneID Application Setup\n\n1. Register your application at [OneID Portal](https://sso.egov.uz)\n2. Get your `client_id` and `client_secret`\n3. Set up your redirect URI to match your application\n\n## 🎯 Usage\n\n### Using Facade (Recommended)\n\n```php\nuse Aslnbxrz\\OneId\\Facades\\OneID;\n\n// Generate authorization URL\n$authUrl = OneID::getAuthorizationUrl();\n\n// Handle authentication callback\n$result = OneID::handle($code);\n\n// Check if authentication was successful\nif ($result-\u003esuccess) {\n    $userData = $result-\u003egetUserData();\n    \n    // Basic user information\n    $pin = $userData-\u003epin;\n    $firstName = $userData-\u003efirst_name;\n    $lastName = $userData-\u003esur_name;\n    $middleName = $userData-\u003emid_name;\n    $fullName = $userData-\u003egetFullName();\n    \n    // Additional information\n    $isVerified = $userData-\u003eisVerified();\n    $userType = $userData-\u003euser_type; // 'I' for Individual, 'L' for Legal\n    $authMethod = $userData-\u003egetAuthMethodName();\n    $birthDate = $userData-\u003egetBirthDate();\n    \n    // Legal entity information (if applicable)\n    if ($userData-\u003eisLegalEntity()) {\n        $legalEntities = $userData-\u003elegal_info;\n        $basicLegalEntity = $userData-\u003egetBasicLegalEntity();\n    }\n    \n    // Process user data...\n} else {\n    // Handle authentication failure\n    $error = $result-\u003eerror;\n    $message = $result-\u003emessage;\n}\n\n// Logout user\n$logoutResult = OneID::logout($accessToken);\n\n// Validate token\n$isValid = OneID::validateToken($accessToken);\n\n// Get user info\n$userInfo = OneID::getUserInfo($accessToken);\n\n// Check configuration\n$isConfigured = OneID::isConfigured();\n$configErrors = OneID::getConfigurationErrors();\n```\n\n### Using Routes (Optional)\n\nIf you have routes enabled, you can use the built-in endpoints:\n\n#### 1. Redirect to OneID\n\n```php\n// Redirect user to OneID authorization\nreturn redirect()-\u003eroute('oneid.redirect');\n```\n\n#### 2. Handle Callback\n\nCreate a callback route in your application:\n\n```php\n// routes/web.php\nRoute::get('/auth/oneid/callback', function (Request $request) {\n    $code = $request-\u003eget('code');\n    \n    if (!$code) {\n        return redirect('/login')-\u003ewith('error', 'Authorization code not provided');\n    }\n    \n    $result = OneID::handle($code);\n    \n    if ($result-\u003esuccess) {\n        // Handle successful authentication\n        $userData = $result-\u003edata;\n        \n        // Create or update user in your database\n        $user = User::updateOrCreate(\n            ['pin' =\u003e $userData['pin']],\n            [\n                'first_name' =\u003e $userData['first_name'],\n                'last_name' =\u003e $userData['last_name'],\n                'middle_name' =\u003e $userData['middle_name'] ?? null,\n                'birth_date' =\u003e $userData['birth_date'] ?? null,\n                'gender' =\u003e $userData['gender'] ?? null,\n            ]\n        );\n        \n        Auth::login($user);\n        \n        return redirect('/dashboard');\n    } else {\n        return redirect('/login')-\u003ewith('error', $result-\u003emessage);\n    }\n})-\u003ename('auth.oneid.callback');\n```\n\n#### 3. Logout\n\n```php\n// Logout from OneID\nRoute::post('/auth/oneid/logout', function (Request $request) {\n    $accessToken = $request-\u003eget('access_token');\n    \n    if ($accessToken) {\n        $result = OneID::logout($accessToken);\n        \n        if ($result-\u003esuccess) {\n            Auth::logout();\n            return response()-\u003ejson(['message' =\u003e 'Logged out successfully']);\n        }\n    }\n    \n    return response()-\u003ejson(['error' =\u003e 'Logout failed'], 400);\n});\n```\n\n### Custom Routes\n\nIf you prefer to disable built-in routes and create your own:\n\n```env\nONEID_ROUTES_ENABLED=false\n```\n\nThen create your own routes:\n\n```php\n// routes/web.php\nRoute::get('/auth/oneid', function () {\n    return redirect(OneID::getAuthorizationUrl());\n})-\u003ename('auth.oneid');\n\nRoute::post('/auth/oneid/handle', function (Request $request) {\n    $result = OneID::handle($request-\u003eget('code'));\n    return response()-\u003ejson($result-\u003etoArray());\n})-\u003ename('auth.oneid.handle');\n\nRoute::post('/auth/oneid/logout', function (Request $request) {\n    $result = OneID::logout($request-\u003eget('access_token'));\n    return response()-\u003ejson($result-\u003etoArray());\n})-\u003ename('auth.oneid.logout');\n```\n\n## 🔧 Configuration Options\n\n### Main Configuration\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `base_url` | OneID API base URL | `https://sso.egov.uz` |\n| `client_id` | Your OneID client ID | Required |\n| `client_secret` | Your OneID client secret | Required |\n| `scope` | Requested permissions | `openid profile` |\n| `redirect_uri` | Callback URL | Required |\n\n### Route Configuration\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `routes.enabled` | Enable/disable built-in routes | `true` |\n| `routes.prefix` | Route prefix | `auth/oneid` |\n| `routes.middleware` | Route middleware | `web` |\n| `routes.names` | Route names | Custom names |\n\n### User Data Configuration\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `user.pin_field` | PIN field name | `pin` |\n| `user.required_fields` | Required user fields | `['pin', 'first_name', 'last_name', 'middle_name']` |\n| `user.optional_fields` | Optional user fields | `['birth_date', 'gender', 'nationality', 'region', 'district']` |\n\n### Security Configuration\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `security.verify_ssl` | Verify SSL certificates | `true` |\n| `security.rate_limiting.enabled` | Enable rate limiting | `true` |\n| `security.rate_limiting.max_attempts` | Max attempts per minute | `5` |\n\n## 🔒 Security Features\n\n- **CSRF Protection**: Built-in CSRF token validation\n- **Rate Limiting**: Configurable rate limiting for API calls\n- **SSL Verification**: SSL certificate verification by default\n- **Input Validation**: Comprehensive input validation\n- **Secure Logging**: Structured logging with sensitive data protection\n\n## 📊 Error Handling\n\nThe package provides comprehensive error handling:\n\n```php\n$result = OneID::handle($code);\n\nif (!$result-\u003esuccess) {\n    switch ($result-\u003eerror) {\n        case 'token_null':\n            // Could not obtain access token\n            break;\n        case 'missing_key':\n            // Required user data missing\n            break;\n        default:\n            // Other errors\n            break;\n    }\n}\n```\n\n## 🧪 Testing\n\nRun the tests with:\n\n```bash\ncomposer test\n```\n\nRun tests with coverage:\n\n```bash\ncomposer test:coverage\n```\n\n## 📝 Logging\n\nThe package logs all important events. You can configure logging in your `config/oneid.php`:\n\n```php\n'logging' =\u003e [\n    'enabled' =\u003e true,\n    'level' =\u003e 'info',\n    'channel' =\u003e 'default',\n],\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🆘 Support\n\nIf you encounter any issues or have questions:\n\n1. Check the [Issues](https://github.com/aslnbxrz/oneid/issues) page\n2. Create a new issue if your problem isn't already reported\n3. Contact the maintainer: [bexruz.aslonov1@gmail.com](mailto:bexruz.aslonov1@gmail.com)\n\n## 🙏 Acknowledgments\n\n- [OneID System](https://e-gov.uz/projects/one-id) - Uzbekistan's unified identification system\n- [Laravel](https://laravel.com) - The PHP framework\n- [Spatie](https://spatie.be) - For the excellent Laravel package tools\n- [Saloon](https://saloon.dev) - For the HTTP client library\n\n## 📈 Changelog\n\n### v1.0.0\n- Initial release with professional architecture\n- Enhanced configuration system\n- Optional route system\n- Comprehensive error handling\n- Security improvements\n- Complete documentation\n- Full test coverage\n- CLI validation command\n- Simple facade interface\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faslnbxrz%2Foneid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faslnbxrz%2Foneid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faslnbxrz%2Foneid/lists"}