Auth0 Home Blog Docs

Using Wordpress Plugin shortcode to pass additional Lock configuration

wordpress

#1

I have “Login by Auth0” Wordpress plugin Version 3.3.1 installed.

I’m trying to use a “shortcode” on a page to display the Auth0 widget in signup mode (vs. the default “login” mode).
I’ve tried every permutation I can think of (many more than this list)- like:

  • [auth0 extra_config='{"mode":"signup"}']
  • [auth0 extra_config='{"mode":"signUp"}']
  • [auth0 options='{"initialScreen":"signUp"}']
  • [auth0 options='{"allowLogin":"false"}']
  • …and many more

Nothing seems to work. However, just to test- I was able to get social-button size to toggle by adding: socialButtonStyle="small" …so some options are being honored.
I just can’t seem to get extra_config or options to work.

Can anyone spot my typo or guide me to a solution?


#2

According to this documentation the extra configuration should be passed through extra_conf and not extra_config (remove the ig part). Having done that and assuming you’re using Lock 10 (the linked documentation above uses mode which if I recall correctly would be for Lock 9) then you would need to specify a value of {"initialScreen":"signUp"} for the additional configuration.


#3

Hi jmangelo- (THANK YOU for replying!)
Thanks for catching that typo. I just tried:

  • [auth0 extra_conf={“mode”:“signup”}]
  • [auth0
    extra_conf={“initialScreen”:“signUp”}]
    and
  • [auth0 extra_conf={mode:‘signup’}
    options={initialScreen:‘signUp’}]
    (perhaps I needed both extra_conf and options?)
    and none resulted in the desired outcome ( like this: alt text )
    This issue is delaying launch of my website, so I’m pretty ‘driven’ to find a solution. I’ve looked over: …/v10/migration-guide , but it’s a lot to digest!

#4

I figured it out and got it working!
When looking at the Auth0 plugin PHP code, I saw that it was doing a json_decode() of the string that’s passed by Wordpress. This info: link text indicated that often the JSON object is not formatted properly.
I checked using this from the command-line:

# php
<?php
$j = '{"mode":"signup"}';
var_dump(json_decode($j));
?>
CTRL-D
Output:  object(stdClass)#1 (1) {  "mode"]=>  string(6) "signup"}

{“mode”:“signup”} is correct JSON. I need to enclose that in ’ ’ to pass as a string (from Wordpress’s text-box). Apparently I am using Lock10, since “mode”:“signup” didn’t work.
But this DID WORK:

[auth0 extra_conf='{"initialScreen":"signUp"}']

I’m good now! Hopefully by documenting my process, I’ve helped others.
Thanks all.


#5

If you only want to allow sign up screen, use the wordpress shortcode with this syntax : [auth0 extra_conf=’{“allowLogin”:false}’]


#6