Typically, such an error can occur if customOAuth app registration does not include the refresh_token
and offline_access
scopes. Without these scopes, the behavior would be consistent with what you have described, where the Salesforce access token expires approximately every 15 minutes.
Please verify that the OAuth app you are using has these scopes enabled in Salesforce 'Platform Tools', Apps → Connected apps → Manage connected apps