feat: login by passing API token in URL #hash#1875
Draft
yusefnapora wants to merge 2 commits intochore/refactor-frontend-api-methodsfrom
Draft
feat: login by passing API token in URL #hash#1875yusefnapora wants to merge 2 commits intochore/refactor-frontend-api-methodsfrom
yusefnapora wants to merge 2 commits intochore/refactor-frontend-api-methodsfrom
Conversation
Deploying with
|
| Latest commit: |
8622dd1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f699041c.nft-storage-1at.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds the ability to set the URL hash to
#authToken=<your-api-key>and use it to authenticate to the API.It adds a
/user/metaroute to return theissuerandpublicAddress, which we were previously getting fromgetMagic().user.getMetadata().The "is logged in" check in
_app.jswas previously usinggetMetadata()to set theuserobject that gets passed through toUserContext. Since we can no longer assume that all logged in users will have a valid magic link session, I had to add a server route to return similar data (issuerandpublicAddress).Stores the token from the fragment in localStorage, so we can clear the fragment and keep accessing the token. Maybe sessionStorage is more appropriate? I forget when to use which, lol.
This probably needs some cleanup, and it's branched off of #1864, so it's a draft for now.
@redaphid will you play with this next week? I probably won't have time to work on it, but I can answer any questions you might have.
To use it with the test user in the local development env, follow this link while the dev server is running from this branch (assuming it's on the default port).