3

In an extension of one of my earlier questions Reset password not working with custom domains from VF page

On checking of the debug logs it was throwing out an exception. This page is accessed from salesforce communities with a custom domain. Any ideas on what could be causing this?

System.UnexpectedException: INVALID_SESSION_ID: This session is not valid for use with the API

04:53:50.123 (123669000)|SYSTEM_METHOD_ENTRY|[42]|System.resetPassword(Id, Boolean)
04:53:50.123 (123737000)|DML_BEGIN|[42]|Op:resetPassword|Type:User|Rows:1
04:53:50.127 (127614000)|EXCEPTION_THROWN|[42]|System.UnexpectedException: INVALID_SESSION_ID: This session is not valid for use with the API
04:53:50.127 (127633000)|DML_END|[42]
04:53:50.127 (127747000)|SYSTEM_METHOD_EXIT|[42]|System.resetPassword(Id, Boolean)
04:53:50.127 (127787000)|SYSTEM_MODE_EXIT|false
04:53:50.127 (127863000)|FATAL_ERROR|System.UnexpectedException: INVALID_SESSION_ID: This session is not valid for use with the API

Here is the apex code

public pageReference changepw() {
    try {
        system.resetPassword(usrId, true);

        usrId='';
        otherMessage = 'An email with the new password has been sent to the user';
    } catch(exception e) {
        otherMessage = e.getmessage();
    }
    return null;
}
  • Do all System methods fail, or just resetPassword? Maybe try calling something simpler, like currentTimeMillis(). – Daniel Ballinger Jul 8 '13 at 0:41
  • @Prady you got any solution for this? – Ratan Paul Nov 28 '18 at 14:49
  • @RatanPaul Sorry i dont remember what we did then. Its probably some 5 years back – Prady Nov 28 '18 at 15:04
  • ok cool I can understand. I got solution as well cheers – Ratan Paul Nov 28 '18 at 15:34
  • 1
    @RatanPaul Gr8, maybe you could just post the answer here, so others could benefit – Prady Nov 28 '18 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.