Store credentials only in session if required

Fixes:
- https://github.com/owncloud/core/issues/7199
That's for stable7 where the interface not exists. - Master will have this changed. I don't think it makes a difference if we use the non-public API here for that. - It's doomed to die anyways.