I using asp.net boilerplate as Web- project, and back-end for mobile apps.
The app is multitenancy.
I have a method to Validate mobile access code.
Here is it code
[AllowAnonymous]
[ProducesResponseType(typeof(UserDataModel), 200)]
[ProducesResponseType(401)]
[HttpPost]
public async Task<IActionResult> ValidateMobileAccessCode(MobileInvitationCodeInput input)
{
var tenant = await _tenantRepository.GetAll().Where(x => x.Id == AbpSession.TenantId).FirstOrDefaultAsync();
var userId = await _userMobileAccessCodeService.ValidateCodeAndGetUserIdAsync(input.CodeValue);
if (userId == null)
{
return Unauthorized();
}
var user = await _userManager.GetUserOrNullAsync(new UserIdentifier(AbpSession.TenantId, userId.Value));
return Ok(new UserDataModel
{
UserId = userId.Value,
CodeValue = input.CodeValue,
Name = user.FullName,
EmailAddress = user.EmailAddress,
CompanyName = tenant == null ? "Host tenant" : tenant.TenancyName
});
}
But this row var tenant = await _tenantRepository.GetAll().Where(x => x.Id == AbpSession.TenantId).FirstOrDefaultAsync();
will return null, as I not have session in mobile app.
How I can get tenant id for the mobile app?
I tried to find solution over docs, but no luck