{"record":{"id":"d4d25758efd73158","repo":"bitwarden/server","slug":"unauthorized-d4d257","errorCode":null,"errorMessage":"Unauthorized.","messagePattern":"Unauthorized\\.","errorType":"http","errorClass":"UnauthorizedAccessException","httpStatus":401,"severity":"error","filePath":"src/Api/AdminConsole/Controllers/OrganizationUsersController.cs","lineNumber":332,"sourceCode":"        return new ListResponseModel<OrganizationUserBulkResponseModel>(\n            result.Select(t => new OrganizationUserBulkResponseModel(t.Item1.Id, t.Item2)));\n    }\n\n    [HttpPost(\"{id}/reinvite\")]\n    [Authorize<ManageUsersRequirement>]\n    public async Task Reinvite(Guid orgId, Guid id)\n    {\n        var userId = _userService.GetProperUserId(User);\n        await _resendOrganizationInviteCommand.ResendInviteAsync(orgId, userId.Value, id);\n    }\n\n    [HttpPost(\"{organizationUserId}/accept-init\")]\n    public async Task<IResult> AcceptInit(Guid orgId, Guid organizationUserId, [FromBody] OrganizationUserAcceptInitRequestModel model)\n    {\n        var user = await _userService.GetUserByPrincipalAsync(User);\n        if (user == null)\n        {\n            throw new UnauthorizedAccessException();\n        }\n\n        var request = new InitPendingOrganizationRequest\n        {\n            User = user,\n            OrganizationId = orgId,\n            OrganizationUserId = organizationUserId,\n            OrganizationKeys = model.Keys.ToPublicKeyEncryptionKeyPairData(),\n            CollectionName = model.CollectionName,\n            EmailToken = model.Token,\n            EncryptedOrganizationSymmetricKey = model.Key\n        };\n\n        var result = await _initPendingOrganizationCommand.InitPendingOrganizationAsync(request);\n\n        return Handle(result);\n    }\n","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/src/Api/AdminConsole/Controllers/OrganizationUsersController.cs#L314-L350","documentation":"Error \"Unauthorized.\" thrown in bitwarden/server.","triggerScenarios":"Thrown in OrganizationUsersController when the current user lacks permission to perform the requested operation on the organization user, such as managing a user of equal or higher role.","commonSituations":"See trigger scenarios.","solutions":["Confirm the caller is an owner or admin of the organization with permission to manage the targeted members.","Ensure the API key or access token used belongs to the organization being modified, not another one.","Check custom role permissions if the caller has a custom role."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}