Skip to content

getAuthToken error handling for 401 & 404 response code #961

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

Merged
merged 10 commits into from
Nov 21, 2019

Conversation

ankitaj224
Copy link
Contributor

  • Clear the local storage; throw an exception with a message to call getId() [ This results in recreation of valid fid & auth token].

- Clear the local storage & throw an exception to call
getId() resulting in recreation of fid
@googlebot googlebot added the cla: yes Override cla label Nov 5, 2019
Comment on lines 373 to 391
if (tokenResult.getResponseCode() == TokenResult.ResponseCode.FID_ERROR
|| tokenResult.getResponseCode() == TokenResult.ResponseCode.REFRESH_TOKEN_ERROR) {
persistedInstallation.insertOrUpdatePersistedInstallationEntry(
persistedInstallationEntry
.toBuilder()
.setRegistrationStatus(RegistrationStatus.AUTHENTICATION_TOKEN_ERROR)
.build());
}

if (tokenResult.getResponseCode() == TokenResult.ResponseCode.OK) {
persistedInstallation.insertOrUpdatePersistedInstallationEntry(
persistedInstallationEntry
.toBuilder()
.setRegistrationStatus(RegistrationStatus.REGISTERED)
.setAuthToken(tokenResult.getToken())
.setExpiresInSecs(tokenResult.getTokenExpirationTimestamp())
.setTokenCreationEpochInSecs(creationTime)
.build());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls use
if ()
else if ()
else

for completeness

persistedInstallationEntry
.toBuilder()
.setRegistrationStatus(RegistrationStatus.AUTHENTICATION_TOKEN_ERROR)
.build());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the auth error case, if anyways you will clear the cache, why do you update it to AUTHENTICATION_TOKEN_ERROR and then clear it in doRegistration()?

An alternative is to clear it here, and like your old code, still return TokenResult from this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Changed it. However, I retained the return type as void because it is unused by the caller of the method.

@ankitaj224
Copy link
Contributor Author

/test smoke-tests


/** This class represents a set of values describing a FIS Auth Token Result. */
@AutoValue
public abstract class TokenResult {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you added this TokenResult, should we hide the proto class InstallationTokenResult only in the remote package?

Because I noticed that FirebaseInstallations class uses both.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both classes are needed in FirebaseInstallations.

InstallationTokenResult as the response of the FIS SDK generateAUthToken API.
TokenResult as the response of FIS Service Client.

Comment on lines 36 to 44
public boolean isSuccessful() {
return getResponseCode() == ResponseCode.OK;
}

public boolean isErrored() {
return getResponseCode() == ResponseCode.FID_ERROR
|| getResponseCode() == ResponseCode.REFRESH_TOKEN_ERROR;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this always be a bi-state? If yes, then I prefer only having isSuccessful()

otherwise when people read the code
if (isSuccessful)
else if (isErrored)
it's a bit confusing that is there another status?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline, not exactly a bi-state. Updated the method name.

Copy link
Contributor

@andirayo andirayo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.
I would recommend to try to keep these PRs as small and focussed on the actual change as possible.
I this case it would have been great to have a PR that only deals with the error handling of 401 and 404 errors as indicated by the PR description.
However, there is a lot of "noise" regarding the introduction of class "TokenResult". I call it "noise" because it is somewhat independent from the core change of this PR.
I think, for future PRs, I recommend to try to make as many of these changes in separate CLs, e.g. one CL that just introduces the new class, not used anywhere. one CL, that uses the new class everywhere, but does not change any logic, and then one CL that actually introduces the new business logic.

Comment on lines 114 to 138
public abstract class TokenResult {
ctor public TokenResult();
method @NonNull public static com.google.firebase.installations.remote.TokenResult.Builder builder();
method @Nullable public abstract com.google.firebase.installations.remote.TokenResult.ResponseCode getResponseCode();
method @Nullable public abstract String getToken();
method @NonNull public abstract long getTokenExpirationTimestamp();
method public boolean isErrored();
method public boolean isSuccessful();
method @NonNull public abstract com.google.firebase.installations.remote.TokenResult.Builder toBuilder();
}

public abstract static class TokenResult.Builder {
ctor public TokenResult.Builder();
method @NonNull public abstract com.google.firebase.installations.remote.TokenResult build();
method @NonNull public abstract com.google.firebase.installations.remote.TokenResult.Builder setResponseCode(@NonNull com.google.firebase.installations.remote.TokenResult.ResponseCode);
method @NonNull public abstract com.google.firebase.installations.remote.TokenResult.Builder setToken(@NonNull String);
method @NonNull public abstract com.google.firebase.installations.remote.TokenResult.Builder setTokenExpirationTimestamp(long);
}

public enum TokenResult.ResponseCode {
enum_constant public static final com.google.firebase.installations.remote.TokenResult.ResponseCode FID_ERROR;
enum_constant public static final com.google.firebase.installations.remote.TokenResult.ResponseCode OK;
enum_constant public static final com.google.firebase.installations.remote.TokenResult.ResponseCode REFRESH_TOKEN_ERROR;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we outsource this to a dedicated model class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is auto-generated api.txt file.

anyString(), anyString(), anyString(), anyString()))
.thenReturn(
TokenResult.builder().setResponseCode(TokenResult.ResponseCode.FID_ERROR).build());
when(mockUtils.isAuthTokenExpired(REGISTERED_INSTALLATION_ENTRY)).thenReturn(true, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add comments here to make it easier to understand what these values are:
e.g.

then Return( true /* isExpired /, false / isValid */)

Comment on lines +232 to +236
if (httpResponseCode == 401) {
return TokenResult.builder()
.setResponseCode(TokenResult.ResponseCode.REFRESH_TOKEN_ERROR)
.build();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the request was not authenticated, what is happening next?
Are we deleting the PersistedInstallationEntry?
If yes, where is this done?
Can you please add a comment what REFRES_TOKEN_ERROR will trigger elsewhere?

@@ -228,6 +228,17 @@ public InstallationTokenResult generateAuthToken(
if (httpResponseCode == 200) {
return readGenerateAuthTokenResponse(httpsURLConnection);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason to not just return the response?

Comment on lines 40 to 43
public boolean isErrored() {
return getResponseCode() == ResponseCode.FID_ERROR
|| getResponseCode() == ResponseCode.REFRESH_TOKEN_ERROR;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this not the following?
return !isSuccessful();

Comment on lines 36 to 44
public boolean isSuccessful() {
return getResponseCode() == ResponseCode.OK;
}

public boolean isErrored() {
return getResponseCode() == ResponseCode.FID_ERROR
|| getResponseCode() == ResponseCode.REFRESH_TOKEN_ERROR;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment on lines 48 to 52
/**
* The amount of time, in seconds, before the auth-token expires for this Firebase Installation.
*/
@NonNull
public abstract long getTokenExpirationTimestamp();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a contradiction:
The JavaDoc indicates this is a duration (a.k.a. "expires_in"), but the name of the variable indicates it is a timestamp (i.e. "expiration_date").
Can you please be more precise and fix either JavaDoc or variable name

@ankitaj224
Copy link
Contributor Author

/test smoke-tests

@ankitaj224 ankitaj224 merged commit 101ee18 into fis_sdk Nov 21, 2019
diwu-arete added a commit that referenced this pull request Dec 10, 2019
* Add Firebase Segmentation SDK and some skeleton code in Firebase Android SDK (#514)

* Add Firebase Segmentation SDK and some skeleton code in Firebase Android SDK

* Add Firebase Segmentation SDK and some skeleton code in Firebase Android SDK

* Address comments #1

* Address comments #1

* Address comments #2

* Implement Firebase segmentation SDK device local cache

* [Firebase Segmentation] Add custom installation id cache layer and tests for it.

* Add test for updating cache

* Switch to use SQLiteOpenHelper

* Switch to use SharedPreferences from SQLite.

* Change the cache class to be singleton

* Wrap shared pref commit in a async task.

* Address comments

* Google format fix

* [Firebase Segmentation] Add custom installation id cache layer and tests for it. (#524)

* Add type arguments in StorageTaskManager (#517)

* Output artifact list during local publishing. (#515)

This effort replaces #494.

* Implement Firebase segmentation SDK device local cache

* fix functions (#523)

* fix functions

* update minsdk version

* remove idea

* Set test type to release only in CI. (#522)

* Set test type to release only in CI.

This fixes Android Studio issue, where it is impossible to run
integration tests in debug mode.

Additionally move build type configuration to FirebaseLibraryPlugin to
avoid projects.all configuration in gradle.

* Add comment back.

* [Firebase Segmentation] Add custom installation id cache layer and tests for it.

* Add test for updating cache

* Switch to use SQLiteOpenHelper

* Minor fix to error message to match the admin sdk. (#525)

* Minor fix to error message to match the admin sdk.

In particular, it *is* allowed to have slashes, etc in field paths.

* Added clean task to smoke tests. (#527)

This change allows the smoke tests to clean all build variants created
by the infrastructure.

* Update deps to post-androidx gms versions. (#526)

* Update deps to post-androidx gms versions.

Additionally configure sources.jar for SDKs.

* Update functions-ktx deps

* Fix versions.

* unbump fiam version in fiamui-app

* Switch to use SharedPreferences from SQLite.

* Change the cache class to be singleton

* Copy firebase-firestore-ktx dependencies on firestore into its own subfolder (#528)

* Wrap shared pref commit in a async task.

* Address comments

* Bump firestore version for release (#530)

Additionally fix pom filter to exclude multidex from deps.

* Google format fix

* Replace some deprecated code.

* Fix some deprecations (#533)

* Implement Firebase segmentation SDK device local cache

* [Firebase Segmentation] Add custom installation id cache layer and tests for it.

* Add test for updating cache

* Switch to use SQLiteOpenHelper

* Switch to use SharedPreferences from SQLite.

* Change the cache class to be singleton

* Wrap shared pref commit in a async task.

* Address comments

* Google format fix

* Replace some deprecated code.

* Package refactor

* nit

* nit

* package refactor (#534)

* Implement Firebase segmentation SDK device local cache

* [Firebase Segmentation] Add custom installation id cache layer and tests for it.

* Add test for updating cache

* Switch to use SQLiteOpenHelper

* Switch to use SharedPreferences from SQLite.

* Change the cache class to be singleton

* Wrap shared pref commit in a async task.

* Address comments

* Google format fix

* Replace some deprecated code.

* Package refactor

* nit

* nit

* Add the state machine of updating custom installation id in the local
cache and update to Firebase Segmentation backend. CL also contains unit
tests.
(The http client is not implemented yet.)

* minor format fix

* Address comments #1

* Add the state machine of updating custom installation id in the local cache and update to Firebase Segmentation backend.  (#545)

* Implement Firebase segmentation SDK device local cache

* [Firebase Segmentation] Add custom installation id cache layer and tests for it.

* Add test for updating cache

* Switch to use SQLiteOpenHelper

* Switch to use SharedPreferences from SQLite.

* Change the cache class to be singleton

* Wrap shared pref commit in a async task.

* Address comments

* Google format fix

* Replace some deprecated code.

* Package refactor

* nit

* nit

* Add the state machine of updating custom installation id in the local
cache and update to Firebase Segmentation backend. CL also contains unit
tests.
(The http client is not implemented yet.)

* minor format fix

* Address comments #1

* Http client in Firebase Segmentation SDK to call backend service.

* Revert unintentional change

* Fix connected device test

* Fix connected device test

* 1. Add a few annotations to make java code Kotlin friendly
2. Some fixes for the http request format

* Fix java format

* Fix API version

* Change the segmentation API implementation to synchronous and put the
entire synchronous code block in async task.

* Fix a async getResult race issue.

* OkHttpClient -> HttpsUrlConnection

* Use gzip for compressing content and fix ourput stream memory leak risk.

* Addressed a few comments

* Http client in Firebase Segmentation SDK to call backend service. (#573)

* Implement Firebase segmentation SDK device local cache

* [Firebase Segmentation] Add custom installation id cache layer and tests for it.

* Add test for updating cache

* Switch to use SQLiteOpenHelper

* Switch to use SharedPreferences from SQLite.

* Change the cache class to be singleton

* Wrap shared pref commit in a async task.

* Address comments

* Google format fix

* Replace some deprecated code.

* Package refactor

* nit

* nit

* Add the state machine of updating custom installation id in the local
cache and update to Firebase Segmentation backend. CL also contains unit
tests.
(The http client is not implemented yet.)

* minor format fix

* Address comments #1

* Http client in Firebase Segmentation SDK to call backend service.

* Revert unintentional change

* Fix connected device test

* Fix connected device test

* 1. Add a few annotations to make java code Kotlin friendly
2. Some fixes for the http request format

* Fix java format

* Fix API version

* Change the segmentation API implementation to synchronous and put the
entire synchronous code block in async task.

* Fix a async getResult race issue.

* OkHttpClient -> HttpsUrlConnection

* Use gzip for compressing content and fix ourput stream memory leak risk.

* Addressed a few comments

* Initial Code structure for FIS Android SDK (#648)

* Adding an interface library for Firebase Installations SDK

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Fixing formattinf issues.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Making InstallationTokenResult an AutoValue class.

* Initial Code structure for FIS Android SDK (#648)

* Adding an interface library for Firebase Installations SDK

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Fixing formattinf issues.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Making InstallationTokenResult an AutoValue class.

* Initial Code structure for FIS Android SDK (#648)

* Adding an interface library for Firebase Installations SDK

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Fixing formattinf issues.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Making InstallationTokenResult an AutoValue class.

* Adding http client to call fis backend service (#659)

* Adding Firebase Installations module

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Initial Code structure for FIS Android SDK (#648)

* Adding an interface library for Firebase Installations SDK

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Fixing formattinf issues.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Making InstallationTokenResult an AutoValue class.

* Http client to call FIS backend service.

* Addresing comments and introducing new FirebaseInstallationService
Exception.

* FirebaseSegmentation SDK
1. Clean up http client response code.
2. When updateCustomInstallationId is called, on non-retryable server errors, the SDK should clean up the local cache. Instead, for retryable errors, SDK can keep the local cache for retrying update later.

* FirebaseSegmentation SDK changes (#673)

* Implement Firebase segmentation SDK device local cache

* [Firebase Segmentation] Add custom installation id cache layer and tests for it.

* Add test for updating cache

* Switch to use SQLiteOpenHelper

* Switch to use SharedPreferences from SQLite.

* Change the cache class to be singleton

* Wrap shared pref commit in a async task.

* Address comments

* Google format fix

* Replace some deprecated code.

* Package refactor

* nit

* nit

* Add the state machine of updating custom installation id in the local
cache and update to Firebase Segmentation backend. CL also contains unit
tests.
(The http client is not implemented yet.)

* minor format fix

* Address comments #1

* Http client in Firebase Segmentation SDK to call backend service.

* Revert unintentional change

* Fix connected device test

* Fix connected device test

* 1. Add a few annotations to make java code Kotlin friendly
2. Some fixes for the http request format

* Fix java format

* Fix API version

* Change the segmentation API implementation to synchronous and put the
entire synchronous code block in async task.

* Fix a async getResult race issue.

* OkHttpClient -> HttpsUrlConnection

* Use gzip for compressing content and fix ourput stream memory leak risk.

* Addressed a few comments

* FirebaseSegmentation SDK
1. Clean up http client response code.
2. When updateCustomInstallationId is called, on non-retryable server errors, the SDK should clean up the local cache. Instead, for retryable errors, SDK can keep the local cache for retrying update later.

* Restrict Firebase API key to Android app package name.

*  Restrict Firebase API key to Android app package name. (#690)

* Implement Firebase segmentation SDK device local cache

* [Firebase Segmentation] Add custom installation id cache layer and tests for it.

* Add test for updating cache

* Switch to use SQLiteOpenHelper

* Switch to use SharedPreferences from SQLite.

* Change the cache class to be singleton

* Wrap shared pref commit in a async task.

* Address comments

* Google format fix

* Replace some deprecated code.

* Package refactor

* nit

* nit

* Add the state machine of updating custom installation id in the local
cache and update to Firebase Segmentation backend. CL also contains unit
tests.
(The http client is not implemented yet.)

* minor format fix

* Address comments #1

* Http client in Firebase Segmentation SDK to call backend service.

* Revert unintentional change

* Fix connected device test

* Fix connected device test

* 1. Add a few annotations to make java code Kotlin friendly
2. Some fixes for the http request format

* Fix java format

* Fix API version

* Change the segmentation API implementation to synchronous and put the
entire synchronous code block in async task.

* Fix a async getResult race issue.

* OkHttpClient -> HttpsUrlConnection

* Use gzip for compressing content and fix ourput stream memory leak risk.

* Addressed a few comments

* FirebaseSegmentation SDK
1. Clean up http client response code.
2. When updateCustomInstallationId is called, on non-retryable server errors, the SDK should clean up the local cache. Instead, for retryable errors, SDK can keep the local cache for retrying update later.

* Restrict Firebase API key to Android app package name.

* Explicitly add internet permission

* Arete floc (#691)

* Implement Firebase segmentation SDK device local cache

* [Firebase Segmentation] Add custom installation id cache layer and tests for it.

* Add test for updating cache

* Switch to use SQLiteOpenHelper

* Switch to use SharedPreferences from SQLite.

* Change the cache class to be singleton

* Wrap shared pref commit in a async task.

* Address comments

* Google format fix

* Replace some deprecated code.

* Package refactor

* nit

* nit

* Add the state machine of updating custom installation id in the local
cache and update to Firebase Segmentation backend. CL also contains unit
tests.
(The http client is not implemented yet.)

* minor format fix

* Address comments #1

* Http client in Firebase Segmentation SDK to call backend service.

* Revert unintentional change

* Fix connected device test

* Fix connected device test

* 1. Add a few annotations to make java code Kotlin friendly
2. Some fixes for the http request format

* Fix java format

* Fix API version

* Change the segmentation API implementation to synchronous and put the
entire synchronous code block in async task.

* Fix a async getResult race issue.

* OkHttpClient -> HttpsUrlConnection

* Use gzip for compressing content and fix ourput stream memory leak risk.

* Addressed a few comments

* FirebaseSegmentation SDK
1. Clean up http client response code.
2. When updateCustomInstallationId is called, on non-retryable server errors, the SDK should clean up the local cache. Instead, for retryable errors, SDK can keep the local cache for retrying update later.

* Restrict Firebase API key to Android app package name.

* Explicitly add internet permission

* Implementing cache for FIS SDK (#694)

* Implementing cache for FIS SDK

* Implementing cache for FIS SDK

* Addressing Di's comments.

* Addressing Di's comments.

* Adding Util class for FIrebaseInstallations APIs.  (#676)

* Adding Firebase Installations module

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Initial Code structure for FIS Android SDK (#648)

* Adding an interface library for Firebase Installations SDK

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Fixing formattinf issues.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Making InstallationTokenResult an AutoValue class.

* Http client to call FIS backend service.

* Addresing comments and introducing new FirebaseInstallationService
Exception.

* Implementing getId method in FirebaseInstallation to call backend.

* 1. Adding instrumentation tests.
2. Introducing serviceClient level and main class exceptions.

* Addressing Di's comments.

* Addressing Rayo's comments

* Updating parameters order in ServiceClient.

* Updating createRandomFid as per Rayo's comments.

* getId() implementation with instrumented tests. (#703)

* getId() implementation with instrumented tests.

* Addressing rayo's comments.
- Detailed JavaDocs
- Renaming FiidCache as PersistedFid

* Addressing rayo's comments.
- Detailed JavaDocs
- Renaming FiidCache as PersistedFid

* Addresing comments to resoleve the following:
- Make registerAnsSaveFid non blocking call in getId()
- PersistedFidEntry builder with default values

* Addressing Ciaran and Rayo's comments.

* Addressing Ciaran's comments

* Addressing Ciaran's comments

* Adding param comments and checking if registration status is valid.

* Correcting lint warning: uses-permission should be declared before
application in AndroidManifest.xml

* Adding custom assertThat with more readable assertions

* Correcting instrumented tests to be reliable.

* Initial Code structure for FIS Android SDK (#648)

* Adding an interface library for Firebase Installations SDK

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Fixing formattinf issues.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Making InstallationTokenResult an AutoValue class.

* Adding http client to call fis backend service (#659)

* Adding Firebase Installations module

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Initial Code structure for FIS Android SDK (#648)

* Adding an interface library for Firebase Installations SDK

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Fixing formattinf issues.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Making InstallationTokenResult an AutoValue class.

* Http client to call FIS backend service.

* Addresing comments and introducing new FirebaseInstallationService
Exception.

* Implementing cache for FIS SDK (#694)

* Implementing cache for FIS SDK

* Implementing cache for FIS SDK

* Addressing Di's comments.

* Addressing Di's comments.

* Adding Util class for FIrebaseInstallations APIs.  (#676)

* Adding Firebase Installations module

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Http client to call FIS backend service.

* Http client to call FIS backend service.

* Initial Code structure for FIS Android SDK (#648)

* Adding an interface library for Firebase Installations SDK

* Adding Firebase Installations module

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Adding Firebase Installations module.

* Readding .idea files that were deleted in previous commit

* Revert "Adding Firebase Installations module"

This reverts commit 2ec4aef.

* Revert "Readding .idea files that were deleted in previous commit"

This reverts commit 7b4ebcf.

* Add firebase installations project path

* Fixing formattinf issues.

* Revert "Adding Firebase Installations module" with hidden files

This reverts commit 2ec4aef.

* Addressing review comments.

* Making InstallationTokenResult an AutoValue class.

* Http client to call FIS backend service.

* Addresing comments and introducing new FirebaseInstallationService
Exception.

* Implementing getId method in FirebaseInstallation to call backend.

* 1. Adding instrumentation tests.
2. Introducing serviceClient level and main class exceptions.

* Addressing Di's comments.

* Addressing Rayo's comments

* Updating parameters order in ServiceClient.

* Updating createRandomFid as per Rayo's comments.

* getId() implementation with instrumented tests. (#703)

* getId() implementation with instrumented tests.

* Addressing rayo's comments.
- Detailed JavaDocs
- Renaming FiidCache as PersistedFid

* Addressing rayo's comments.
- Detailed JavaDocs
- Renaming FiidCache as PersistedFid

* Addresing comments to resoleve the following:
- Make registerAnsSaveFid non blocking call in getId()
- PersistedFidEntry builder with default values

* Addressing Ciaran and Rayo's comments.

* Addressing Ciaran's comments

* Addressing Ciaran's comments

* Adding param comments and checking if registration status is valid.

* Correcting lint warning: uses-permission should be declared before
application in AndroidManifest.xml

* Adding custom assertThat with more readable assertions

* Correcting instrumented tests to be reliable.

* Updating api.txt to resolve api-information presubmit check.

* Adding api.txt for fisbase-installations-interop

* Updating subprojects.cfg

* FIS getAuthToken implementation. (#769)

* FIS getAuthToken implementation.

* FIS getAuthToken implementation.

* 1. Addressing Ciaran's comments
2. Renaming InstallationTokenResult TokenExpirationTimestampMillis field to TokenExpirationInSecs

* 1. Addressing Ciaran's comments
2. Renaming InstallationTokenResult TokenExpirationTimestampMillis field to TokenExpirationInSecs

* Updated IntDef usage in firebase-installations

*  Using CountDownLatch to await instead of executor.awaitTermination

* Addressing Di's comments.

* Addressing Di's comments.

* Addressing Ciaran's comments to replace latch with a custom listener.

* Adding onSuccess to AwaitListener.

* Cleaning up the code as per the ciaran's comments.

* Addressing Di's comments.

* 1. Handling multiple calls to getAUthToken()
2. Minor code changes as per the offline discussion with Rayo

* Fixing api-information presubmit check.

* updating api.txt for firbase-installations-interop

* Addressing Ciaran's comments.

* Fixing check-changed - GoogleJavaFormat error.

* Addressing ciaran`s comments

* nit fixes to executor : use unblocking queue.

* FID delete() implementation. (#813)

* FID delete() implementation.

* Addressing ciaran's comments.

* Refractoring the code to be inline.

* Adding headers for Chemist to check API key restriction. (#821)

* Enabling FIS network call timeout. (#827)

* Enabling FIS network call timeout.

* Addressing Di's comments

* Simplifying FirebaseInstallations class by adding listeners. (#847)

* Simplifying FirebaseInstallations class by adding listeners.

* Addressing ciaran's comments to return same token if multiple getAuthToken()
calls are triggered simultaneously.

* Cleaning doRegistration method.

* Fixing FISClient to correctly parse expiration timestamp. (#848)

* Updating getAuthToken to return creation timestamp (#884)

* Propagating the exceptions to the clients. (#856)

* Merging changes into fis_sdk (#910)

* Fixing FISClient to correctly parse expiration timestamp. (#848)

* Updating getAuthToken to return creation timestamp (#884)

* Propagating the exceptions to the clients. (#856)

* Extract FID from FIS createInstallation response (#888)

* Addressing Rayo's comment: Rename PersistedFidEntry to (#899)

* Implementing retry once for FIS Client. (#895)

* Simplifying FirebaseInstallations class by adding listeners. (#847)

* Fixing FISClient to correctly parse expiration timestamp. (#848)

* Updating getAuthToken to return creation timestamp (#884)

* Propagating the exceptions to the clients. (#856)

* FIS error handling (#911)

 1. Mark PersistedInstallationEntry status UNREGISTERED incase of 500 errors
2. Store detailed 4xx server exceptions in the local storage. In the
succeeding getId calls,return these exceptions to the clients

* Reuse existing Iid as Fid (#924)


* Add FisError to the persisted installation entry. (#931)

* touch file (#993)

1 line change on comment

* getAuthToken error handling for 401 & 404 response code (#961)

* getAuthToken error handling for 401 & 404 response code:
- Clear the local storage & throw an exception to call
getId() resulting in recreation of fid

* Renaming getAuthToken to getToken. (#1026)

* Add heartbeat to fis sdk (#1037)

* add tests

* update api

* installations

* Fixes for multi-process access (#1042)

* Switch from using SharedPreferences to a flat file

* Fixes for multi-process access

 - switch from shared prefs to a flat file
 - protect generate Fid for cross-process and cross-thread accesses
 - make doRegistration only read the prefs once at the beginning and
   clean up the flow
 - pass the forceRefresh flag into doRegistration rather than
   storing it in a global

* revert the name of the FID prefs write call

* fix formatting issues

* Fix the cross process locking

The check if a new FID was needed was not in the critical region.

* some small changes from the review

* fix the java format and update the api file

* Remove FirebaseSegmentation from fis_sdk branch. (was added by mistake)

* Add separator line back

* Update api info for FIS SDK
@firebase firebase locked and limited conversation to collaborators Dec 22, 2019
@kaibolay kaibolay deleted the authToken_server_error branch September 14, 2022 17:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Override cla size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants