Replies: 1 comment 2 replies
-
Ok I think I have solved this was observing this tutorial found here https://github.com/Web3Auth/examples/blob/main/web-core-sdk/server-side-verification/ssv-via-social-nextjs-core-example/pages/App.tsx Gist of how to get the private key, you will need to call the This snippet or link to the sample implementation should be included in the Server Side Verification docs here https://web3auth.io/docs/server-side-verification/social-login-users. It is an important missing step const getUserInfo = async () => {
if (!web3auth) {
uiConsole('web3auth not initialized yet')
return
}
const user = await web3auth.getUserInfo()
const privKey = await web3auth.provider?.request({
method: 'eth_private_key',
})
const pubkey = getPublicCompressed(Buffer.from(privKey, 'hex')).toString(
'hex',
)
// Validate idToken with server
const res = await fetch('/api/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + user.idToken,
},
body: JSON.stringify({appPubKey: pubkey}),
})
if (res.status === 200) {
console.log('JWT Verification Successful')
uiConsole(user)
} else {
console.log('JWT Verification Failed')
uiConsole('JWT Verification Failed')
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need some clarifications regarding the
app_scoped_privkey
as this seems like a crucial detail you need to authenticate the jwt tokens obtained from theidToken
I am following the tutorial found here:
https://web3auth.io/docs/server-side-verification/social-login-users
I know how to obtain the
idToken
. This is possible using something likeconst user = await web3AuthInstance.getUserInfo();
However, there seems to be missing documentation regarding the
app_scoped_privkey
within the web3auth docs.The documentation states
and then shows the following snippets
There seems to be missing instructions regarding how
app_scoped_privkey
can be obtain atm. Would need some help on thisBeta Was this translation helpful? Give feedback.
All reactions