When I am adding a new entry to the child table through mobile app, it is not fetching the user id. It is working as expected sometimes but sometimes it is unable to fetch the user id.
This is the business process that I have written to fetch the current user but it is not able to fetch everytime. For some users it is fetching the current user but sometimes it is not able to fetch the current user.
Here it is able to fetch the current user and it is showing the user name and user email.
Here it is not fetching the current user.
You need to add more logs to your processes to detect exact problem. Provided information is not enough to understand it.
Check that onCreate trigger really starts and API request return result without error.
Possible problem - user is not authorized but its required for profile endpoint.
Hi,
I Have done the needful whichever is guided in the instructions but still stuck with the same issue.
The LOG is getting unauthorised error. Can you please give some more details on how to solve authorisation issue .
I checked the response from the API header and got the response as unauthorised. I have attached the response from swagger
With the same endpoints and logic:
- when logged in with [email protected]
The log shows no error and the profile gets loaded correctly
- when logged in with [email protected]
The log shows Unauthorised error and the profile doesn’t load correctly as the API response is unauthorised
@Jyoti_Deep So you basically saying that all endpoints that require authorization are not working when you properly send requests with auth token or only /api/user/profile/ ?
If one user can call endpoint and another can’t, please check user groups and auth middleware on that endpoint.
@OlegSotnikov I have checked the user groups and auth middleware even tried by allowing all categories of user but still stuck with the same issue
Even when new user profile is created using signup, The account gets created succesfully and the user details reflects in the DB but the same problem persists and profile doesn’t load when logged in with the new account.
To narrow down what’s happening, please answer questions below:
- Is the problem exists for any new user? Are existing users working fine?
- Can you successfully authenticate with mentioned user account?
- Can you call other endpoints successfully using mentioned user account?
- Make sure that user has as least one group assigned.
- Make sure that you have that group in your endpoint
- Check that your user is active, no 2FA, no API protection enabled
- Yes, for new users also it is unable to fetch user id. Few of the existing users working fine.
- Yes for the account mentioned above ( [email protected] ) it is showing expected id info.
- Yes above mentioned user account is able to call other end points successfully.
The user has assigned the group in bussiness process.
Yes I have added the “Users” group in that end point.
Token auth is enabled here. Do I need to change any settings here ?
@Jyoti_Deep
To send group from the frontend during registration is a huge security issue. Never do like that in production.
Please show you backend logic of the registration endpoint.