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 for auth update, automate minification & README #6

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

kevin-david
Copy link
Contributor

@kevin-david kevin-david commented Nov 23, 2024

A change broke this script again. This fixes it.

At the same time, I figured it would be good to make minification more verifiable vs checking in random minified files that could do anything.

Fixes #7

There are multiple keys that contain `@@auth0spajs@@` now:
```
0:"@@auth0spajs@@::<userId>::@@user@@"
1:"@@auth0spajs@@::<userId>::https://api.onepeloton.com/::openid offline_access"
```

Only load the one that's the actual API key, the second one.
@@ -4,7 +4,7 @@ rideID = rideID[rideID.length - 1];

var bearerToken;

const auth0Key = Object.keys(localStorage).find(key => key.startsWith('@@auth0spajs@@'));
const auth0Key = Object.keys(localStorage).find(key => key.startsWith('@@auth0spajs@@') && key.indexOf("api.") > 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Optimally this would be one place instead of three. But didn't feel like getting into that :)

Required some minor reformatting
@kevin-david kevin-david changed the title Fix for auth update, automate minification Fix for auth update, automate minification & README Nov 23, 2024
@ZV3zrmCT ZV3zrmCT merged commit 6dab3af into ZV3zrmCT:master Nov 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auth change broke script/bookmarklet
2 participants