In the United Kingdom:
A person has no authority to access an online account of a deceased relative, unless this has been agreed with the operator of the website (etc). If a Power of Attorney over the deceased's financial affairs existed, this ceases upon death.
Using a person's login credentials without permission from the owner of the website would be a breach of the Computer Misuse Act 1990, as amended by Part 5 of the Police and Justice Act 2006, and Part 2 of the Serious Crime Act 2015.
Actus Reus
The offence is made out once a defendant has caused a computer, which
would include his own computer, to perform a function with intent to
secure access.
The access to the program or data which the accused intends to secure
must be 'unauthorised' access.
Mens rea
There are two elements:
There has to be knowledge on the part of the offender that the access
is unauthorised; mere recklessness is not sufficient. This covers not
only hackers but also employees who deliberately exceed their
authority and access parts of a system officially denied to them.
Crown Prosecution Service legal guidance
Additional note for accessing online banking and similar accounts:
A person who accessed a bank computer with the intention of transferring the deceased's funds to themself (such funds being the property of the estate, not the person) thus committing theft, would potentially be committing the further offence under Section 2 of the CMA of Unauthorised access with intent to commit or facilitate commission of further offences
If the person has a legitimate claim on the funds in the bank account, i.e. they are an executor or administrator of the estate, there is an established procedure to claim the funds from the bank. This does not include being given access to the deceased's accounts or statements, as these remain confidential. The bank will provide a closing balance at the date of death, together with a list of regular payments in/out of the account (those being parties the executor/administrator should advise of the death) together with a statement for any transactions after death ie during the period of executry of the estate.