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

Issues with window.pi #232

Open
gachezra opened this issue Nov 14, 2024 · 4 comments
Open

Issues with window.pi #232

gachezra opened this issue Nov 14, 2024 · 4 comments

Comments

@gachezra
Copy link

Am I the only one not getting any response when clicking sign in. I want to get a feel of how window.pi works so that I can play around with it to make something useful. If you know how to use window.pi please let me know. Here's the console error:

Uncaught (in promise) TypeError: window.Pi is undefined o index.jsx:13

@Chinedu001-j
Copy link

Sorry about that but can you tell me exactly the issue you have with the app_

@Chinedu001-j
Copy link

@gachezra
Copy link
Author

gachezra commented Nov 24, 2024

This is the link to my project.
I'm still new with your environment but not new with JavaScript, so forgive some of my simple mistakes. But have a look at this code, which supposedly authenticates the user when running in the sandbox or the pi browser app:

const signIn = async () => { const scopes = ['username', 'payments']; console.log('Scopes: ', scopes); console.log('Whatever this is: ', window.Pi); const authResult = await window.Pi.authenticate(scopes, onIncompletePaymentFound); signInUser(authResult); setUser(authResult.user); }

const signInUser = (authResult) => { axios.post('/user/signin', { authResult }); setShowModal(false); }

I'm still on the demo app since I have to figure out the basics before I start working on my project. Most apps authenticate while opened but not this. Here's the link to the app and the link to the page file. If I could just get a bit more info on how the window.pi object works, I will be on my way to building my app.

@gachezra
Copy link
Author

I want to know how the window.pi object works and if it is affected by code type, JavaScript or TypeScript.

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

No branches or pull requests

2 participants