I am having problem in Sharepoint provider hosted app. I have created one app with CSOM for script injection in sharepoint online and hosted in azure. I took solution from GitHub PNP script injection. But after every 12 hours my app stops working. I don't know the reason. It is a low trust app. I read many articles where it has been written that sharepointcontext.cs and tokenhelper.cs class files managing tokens. But I tried every work around but no luck. If some can help me out this, some thing in configuration like client ID or client secret key is missing or upgrade.
It sounds like the token is expiring, based on the 12 hour time span you mention. How exactly do you know it stops working after 12 hours? Are you actively using it and then all of a sudden you get an error? What does that error look like? Have you checked F12 (developer tools) console window to see what the error message is?
If the token is expiring, ensure you have logic in your access layer to catch expired token exceptions. In the event the token expires, you need to re-issue a token request, either by using the refresh token (lasts ~6 months), or by initiating the POST redirect flow that landed you a valid access token in the first place.