", "author": { "@type": "Person", "name": "viseriesdba", "image": "https://ia800305.us.archive.org/31/items/discordprofilepictures/discordblue.png", "url": "https://discordapp.com/users/1062072025658699886" }, "datePublished": "2024-07-22T14:36:16.675+00:00" } ], "text": "Hi all! So I am trying to set up an authentication with Neynar (Farcaster) like this - https://docs.neynar.com/docs/how-to-let-users-connect-farcaster-accounts-with-write-access-for-free-using-sign-in-with-neynar-siwn#step-2-fill-in-data-client_id-in-the-button-code.I pasted the button on the page and it works - it opens the redirect and I can connect my Farcaster account and in the console it says it receives the authetication data, but - 1) The popup doesn't close2) I have a handler like this set up and it is not being triggered - toddle.actions.setToSessionStorage.handler({ \"Key\": “neynar”, \"Value\": data});(P.S. I have to save to session storage because the token is used as a parameter in the authentication, not as a bearer)" }
PricingBlog

A handler that gets data from a redirect auth?

  • viseriesdba-1264954027339415613

    viseriesdba

    1 year ago

    Hi all! So I am trying to set up an authentication with Neynar (Farcaster) like this - https://docs.neynar.com/docs/how-to-let-users-connect-farcaster-accounts-with-write-access-for-free-using-sign-in-with-neynar-siwn#step-2-fill-in-data-client_id-in-the-button-code.

    I pasted the button on the page and it works - it opens the redirect and I can connect my Farcaster account and in the console it says it receives the authetication data, but -

    1) The popup doesn't close
    2) I have a handler like this set up and it is not being triggered -

    toddle.actions.setToSessionStorage.handler({
    "Key": “neynar,
    "Value": data
    });

    (P.S. I have to save to session storage because the token is used as a parameter in the authentication, not as a bearer)
  • the code i use for the button -

    <html>
    <body>
    <div
    class="neynar_signin"
    data-client_id="9d8ff49a-5d84-40a5-bf9c-1391beb6606f"
    data-success-callback="onSignInSuccess"
    data-theme="dark"> <!-- defaults to light, unless specified -->
    </div>
    <script src="https://neynarxyz.github.io/siwn/raw/1.2.0/index.js" async></script>
    <script>
    // Define the onSignInSuccess callback function
    function onSignInSuccess(data) {
    console.log("Sign-in success with data:", data);
    // Your code to handle the sign-in data

    // Assuming data.token contains your JWT token
    toddle.actions.setToSessionStorage.handler({
    "Key": “neynar,
    "Value": data
    });
    }
    </script>
    </body>
    </html>