I have a SharePoint application with a provider hosted app. User's can access Provider hosted app URL directly provided they have access to App and their user profile is created already.
I have a situation right now in production where user is added to SharePoint group but his user profile is not created and when he access Provider hosted app URL directly gets forbidden error.
UserProfileException caught.. Exception Microsoft.Office.Server.Security.UserProfileNoUserFoundException: 3001002;reason=The incoming identity is not mapped to any user profile account in SharePoint. Possible cause is that no user profiles are created in user profile database. Contact your administrator.
Currently there is no CSOM/REST or JSOM way you can create user profile, only SSOM is supported which I cannot use in my prod.
Another solution can be to ask user to browse to SharePoint site first which will create user profile but this is just a work around.
Is there any way a Provider hosted app can ensure that user is created by some means if user profile doesnt exists?