-
Notifications
You must be signed in to change notification settings - Fork 72
Tpa auth client side #469
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
Tpa auth client side #469
Conversation
Deploying augmentos-account with
|
Latest commit: |
e5e2b46
|
Status: | ✅ Deploy successful! |
Preview URL: | https://892848fd.augmentos-e84.pages.dev |
Branch Preview URL: | https://tpa-auth-client-side.augmentos-e84.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Awesome job 😄
This requires a TPA_AUTH_JWT_PRIVATE_KEY to be added to the cloud .env |
It looks like some older versions of android have a web view that doesn't support the JWT encryption. So I'm going to need to test this more before we merge it. |
…pa-auth-client-side
Deploying prod-augmentos-account with
|
Latest commit: |
8578d5a
|
Status: | ✅ Deploy successful! |
Preview URL: | https://a604b82c.augmentos-e84.pages.dev |
Branch Preview URL: | https://tpa-auth-client-side.augmentos-e84.pages.dev |
Deploying augmentos-docs with
|
Latest commit: |
b68972a
|
Status: | ✅ Deploy successful! |
Preview URL: | https://7309e4bb.augmentos-docs.pages.dev |
Branch Preview URL: | https://tpa-auth-client-side.augmentos-docs.pages.dev |
I have fixed the issue with Android web views
I also added a new @augmentos/react library that simplifies making react frontends. The docs are also updated, see https://tpa-auth-client-side.augmentos-docs.pages.dev/react-webviews |
The next steps links in the react web view docs are broken: |
## Manual Implementation (Browser-Only React with No Backend) | ||
|
||
If you're not using the AugmentOS SDK, you can implement the authentication flow manually. | ||
If you're building a webview app that runs entirely in the browser (e.g., React, Vue, etc.), you can securely verify the AugmentOS user token without any backend. This approach uses the [`jose`](https://github.com/panva/jose) library to verify the JWT against AugmentOS's public keys, stores the token in `localStorage`, and exposes the user ID to your app. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick:
The copy here might be a little confusing for developers, As A backend (the TPA server) is still required,
it's just that in the second scenario the TPA server is not the server that is serving the static HTML/JS files.
Rough ideas for copy that might better explain it for dev's :
- TPA server hosts & serves your Website.
- i.e HTML/JS (this could be the outputs of a react/vue project after they've built it to generate static html/js/css files) in public folder in their TPA project and served by express server from @augmentos/sdk
- Website hosted separately from TPA server
- TPA backend
- Website hosted else where: i.e Cloudflare Pages, Netlify, Github pages
Add support for TPA webview user auth even in purely client-side webviews, by changing the the token exchange mechanism into a public key verifiable JWT with the user id.
Updates:
This requires a
TPA_AUTH_JWT_PRIVATE_KEY
to be added to the cloud .env