Update the immersive reader token #9952
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
A change went live that returned Immersive Reader tokens with invalid expiration dates. Those tokens will effectively never expire; this becomes a problem since we do not remove invalid tokens. Meaning anyone who received the bad token is stuck unless they manually remove the token from local storage themselves.
Solution
Change the name of the Immersive Reader token so that those with a broken token will pick up a new one. Then make sure to remove the Immersive Reader token if there is a problem using it. That way if something like this happens again, we do not have to worry about old tokens sticking around.
Validation
See Arcade build using these changes.
await getTokenAsync();
inlaunchImmersiveReaderAsync
. Run the immersive reader again, set the token to gibberish. Confirm that the token is present in local storage. Continue the function, click okay on the Immersive Reader error modal. Confirm that the token has been removed from local storage.Notes
This partially addresses microsoft/pxt-microbit#5574, though not until this change is served can we call it closed.