Have a trouble:
My project have a X service in [MyProject].Application.Services with override GetAll and Create methods.
- When using swagger (web.host) or web app the Create method add in table a new record with CreationTime and CreatorUserId columns (as all services in ZERO) and also retreive the TenantId with AbpSession.TenantId
- When launching mobile app (Android emulator) and using X service (Create method) the AbpSession is empty (UserId and TenantId null) and also the CreatorUserId is inserted in table as NULL
Other values sent from mobile to service are inserted well, just AbpSession values always null. No errors appear, only fields CreatorUserId and AbpSession.TenantId as NULL.
Why from mobile app (emulator) can't access to AbpSession? What am I doing wrong? Need help
Thanks!
5 Answer(s)
-
0
Does your application service method require authorization?
-
0
The service require authorization, but I tested it with Authorization.Users and Anonymous decorators... Always NULL in AbpSession
-
0
It is possible that your mobile client's request did not carry a token, causing the server to fail to resolve the AbpSession.
Try to remove AllowAnonymous and see what happens.
-
0
Yes! When methods are with "AppPermissions.Pages_Administration_Users" permission, the response is "current user did not login the application".
We are using Identity with IdentityModel (OpenId connection OAUTH), not Microsoft Identity... how the mobile app get the Token? And why using methods in web all is fine, but not in mobile?
-
0
Hi, you can check if the token is persisted by calling
IDataStorageService.RetrieveAuthenticateResult()
Upon login sucessfully, token will be mapped to
AuthenticationResultModel
and persisited.See https://github.com/aspnetzero/aspnet-zero-core/blob/a99934d7851ff4b55a88d3df1ab9457afd25a9be/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Application.Client/ApiClient/AccessTokenManager.cs#L61-L64