Bring OAuth token refresh into the js-sdk (#5520)
* Bring OAuth token refresh into the js-sdk
Changes the API so that refreshing tokens is now js-sdk's job rather
than the client, so the js-sdk fetches the auth metadata. This allows
it to construct the OAuth object lazily which means it can retry if, for
example, there was no internet when the client started (otherwise the app
would have to wait until it could fetch auth metadata before starting the
client).
Also removes support for the unstable prefixed MSC2965: this has
been stable for about a year now. Supporting stable/unstable meant
we had to check /versions before requesting auth metadata, which of
course we had to do without auth, else get infinite loops, which would
have added a buncvh of complexity to manage fetching and caching authed/
unauthed /versions requests.
* Move redirect uri to methods that use it
Rather than the context since it might not be the same throughout
the whole lifetime of the client.
Also fix some tests.
* Fix circular dependency
* Rename method
* Factor out duplicated test code
to make sonar happy
* more code dedup
* Add tsdoc link
* Fix doc
* Fix doc link
* Fix doc links try 2
* Fix type name
* Fix elsewhere
* Separate out the auth metadata callback
* Update tests