textileio / community

Textile community repo. Includes a sub-project for documentation 📚 and a discussion board for ideas & questions.
https://docs.textile.io/
MIT License
101 stars 44 forks source link

Authorising with magic.link #302

Open owengot opened 2 years ago

owengot commented 2 years ago

In the javascript documentation there are examples of authenticating users with MetaMask and 3Box - I am wondering how to go about doing this with magic.link? Going by the 3box example, I would generate a private key and convert it to a string, magic.link then offers an endpoint to generate an ID Token - so I have ended up with this:

const identity = await PrivateKey.fromRandom()
const identityString = identity.privKey.toString()
const idToken = await magic.user.generateIdToken({ attachment: identityString });

however the return ID payload, after base64 decode, does not resemble the private key originally generated. In this case it looks something like 0xd05f8c5d1d81818f77538579bff1c944acf3165b606c19a11e8086d36eca739e0c96ad19eaacbe435352b18672023062698b22723677ff8bf87355d4e104d1281b

Would appreciate any advice.

joewagner commented 2 years ago

@owengot Sorry for the delay in response here. Concerning your issue, I'm not familiar enough with magic.link to be much help. We have moved to using discord almost everything feel free to join us there https://discord.gg/P5yw8eHE

Looking at the magic docs it looks like the value you're seeing is an encoded JSON tuple that would be [proof, claim]. Once you decode it, what are you seeing?