Specify a timeout when making the HTTP request to refresh access tokens. (#1356)

* Specify a timeout when making the HTTP request to refresh access tokens.

Without the timeout, some requests are silently never made.

Fixes realm/realm-js-private#338.

* Add a changelog entry.
This commit is contained in:
Mark Rowe 2017-09-27 13:52:14 -07:00 committed by Kenneth Geisshirt
parent 273d241999
commit 666d606914
2 changed files with 5 additions and 1 deletions

View File

@ -8,6 +8,7 @@
### Bug fixes
* Fixed port conflict between RN >= 0.48 inspector proxy and RPC server used for Chrome debugging (#1294).
* An issue where access tokens were not refreshed correctly has been addressed.
### Internal
* Alignment of permission schemas.

View File

@ -76,7 +76,10 @@ function refreshAccessToken(user, localRealmPath, realmUrl) {
provider: 'realm',
app_id: ''
}),
headers: postHeaders
headers: postHeaders,
// FIXME: This timeout appears to be necessary in order for some requests to be sent at all.
// See https://github.com/realm/realm-js-private/issues/338 for details.
timeout: 1000.0
};
performFetch(url, options)
.then((response) => response.json().then((json) => { return { response, json }; }))