Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6182: China sync servers using wrong URL #6213

Merged
merged 1 commit into from
Mar 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Providers/Profile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,10 @@ open class BrowserProfile: Profile {
public class ScopedKeyError: MaybeErrorType {
public var description = "No key data found for scope."
}

public class SyncUnlockGetURLError: MaybeErrorType {
public var description = "Failed to get token server endpoint url."
}

fileprivate func syncUnlockInfo() -> Deferred<Maybe<SyncUnlockInfo>> {
let d = Deferred<Maybe<SyncUnlockInfo>>()
Expand All @@ -947,8 +951,13 @@ open class BrowserProfile: Profile {
d.fill(Maybe(failure: ScopedKeyError()))
return
}
// @TODO remove hard-coded URL
d.fill(Maybe(success: SyncUnlockInfo(kid: key.kid, fxaAccessToken: accessTokenInfo.token, syncKey: key.k, tokenserverURL: "https://token.services.mozilla.com/")))

guard case .success(let tokenServerEndpointURL) = RustFirefoxAccounts.shared.accountManager.getTokenServerEndpointURL() else {
d.fill(Maybe(failure: SyncUnlockGetURLError()))
return
}

d.fill(Maybe(success: SyncUnlockInfo(kid: key.kid, fxaAccessToken: accessTokenInfo.token, syncKey: key.k, tokenserverURL: tokenServerEndpointURL.absoluteString)))
}
return d
}
Expand Down