Axios post /auth/auth0 not button_to RAILS javascript

Hi! Currently we have a form email login if a user already have an account.

Now we want to put auth0 just replaced the “Have an account? Login” button into auth0

<%= button_to “Have an account? Login”, “/auth/auth0”, method: :post%>

But the problem is the button_to is a form and it is inside a form already and there is also a submit button present “Continue”

now in javascript i tried link_to to call a javascript post but I’m having a problem of

Authentication failure! ActionController::InvalidAuthenticityToken: ActionController::InvalidAuthenticityToken, ActionController::InvalidAuthenticityToken

When i inspect element there is hidden element created by auth0. I’m thinking this is what i need to also submit in axios post

< input type=“hidden” name=“authenticity_token” value=“tOJXVaW7bKUK/n/8AYRzQQxPeGeNFVhDown3I2WyS1nZQT6j/i+XR9ecankaO7J3J+yJjxT6QPjhtAsZE5XN7w==” autocomplete=“off” >

      var authBody = {
        authenticityToken: ?????

        method: "post",
        url: "/auth/auth0",
        data: authBody },

UPPPPP need help… In need of clarification

Hi @csuntay,

I’m having a bit of trouble understanding this question. Are you saying you want to direct your user to the Auth0 hosted signup page?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.