Auth0 Home Blog Docs

auth0-js equivalent for auth0-lock's AllowedConnections?

auth0-js

#1

I would like to turn different social logins and password login on and off via javascript in auth0-js. I see this is an option with auth-lock (https://auth0.com/docs/libraries/lock/v10/configuration#allowedconnections-array-) with allowedConnections but I don’t see any documentation in auth0-js. Is it possible to do this?


#2

To my knowledge, the allowedConnections in Lock influences the UI shown by Lock as all connections are still enabled for the client application; you just influence the ones that instance of Lock will show in the user interface.

Auth0.js on the other hand is a UI-less library so if you have a specific situation where you don’t want to show some of the enabled connections you just don’t include them in your custom UI.


#3

Ok, I didn’t realize that it was calling auth0-lock from my hosted page. I was able to modify the hosted page to look for a query string parameter, but I don’t see a way to pass it to my hosted page from auth0-js. Is there a parameter for appending a QS parameter, or is there another way to pass information over?

THanks,

-Mike


#4

Ok, I didn’t realize that it was calling auth0-lock from my hosted page. I was able to modify the hosted page to look for a query string parameter, but I don’t see a way to pass it to my hosted page from auth0-js. Is there a parameter for appending a QS parameter, or is there another way to pass information over?

THanks,

-Mike


#5

I think technically it’s possible to pass as an additional parameter; if you’re using Auth0.js to navigate to the hosted login page I think you’ll have to pass the additional parameter as a new property in the options object passed to the authorize method.

Also have in mind that if you’re doing because you already know the connection the end-user will use to authenticate then you may want to read the note in: https://auth0.com/docs/hosted-pages/login#how-does-the-hosted-login-page-work


#6

Adding an extra option “foo” gives me this warning:

Following parameters are not allowed on the `/authorize` endpoint: [foo]

It does, however, seem to add the parameter to the query string. (It requires a cast in TypeScript, but that’s not so big an issue.)

As for the connection parameter, my use-case is just to be able to configure the subset of login methods from the caller, so I don’t think that is what I need for this particular situation.


#7

Adding an extra option “foo” gives me this warning:

Following parameters are not allowed on the `/authorize` endpoint: [foo]

It does, however, seem to add the parameter to the query string. (It requires a cast in TypeScript, but that’s not so big an issue.)

As for the connection parameter, my use-case is just to be able to configure the subset of login methods from the caller, so I don’t think that is what I need for this particular situation.


#8

It may be that the approach I linked before is not recommended; in the docs the section below discusses another similar possibility. To be honest I never noticed that warning so at this time I don’t have definitive information to share about it.


#9

In the meantime I passed this request as a scope instead of qs.


#10