[Coldbox 4.1.0] [module nsg-module-google 1.0.5]

Has anyone used nsg-module-google module for social login? I’ve been messing with it for awhile and just not getting anywhere. I loaded via commandbox and it downloaded a couple of dependencies (nsg-module-oauth and nsg-module-security). Mainly I’m wondering -

  1. How do you interface with this module?

  2. The google auth uses oauth2 and it’s mentioned in the readme for nsg-module-google but the dependency ndg-module-oauth says "Currently this module only supports OAuth v1 ". ??

I’ve tried quite a few things and getting nowhere. Has anyone on here used this?

Thank you!

Irv

I’ve not used it. Jeremy DeYoung contributed it a while back so you could try reaching out to him.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I’ve released a social login module a while ago: http://www.coldbox.org/forgebox/view/Socialite

You can login with facebook,google,linkedin and github at the moment. You could try it out.

Hello! I will!

I looked at it as well and for some reason downloaded the other one. Not sure why. I’ll definitely download that one tonight and try it out.

Thanks!

Irv

Tropicalista, you can’t imagine how happy I was to see that work! I had to wade thru Coldbox’s info on modules a bit but I got there!

Question - I’m getting there via [site]/socialite/home/auth?provider=google but I see in your readme what looks like a way to call it from within a handler ( socialite.init().with(‘facebook’).redirect() ) . Wondering proper way to implement this module. Was thinking a generic login page has links to /socialite/home/auth?provider=xyz but maybe I’m missing the point?

Thank you!

Irv

PS - socialitemanager.cfc seems to have a stray comma on line 82. Wasn’t sure how to contact you except here - thanks!

So still stuck it seems.

moduleconfig says {pattern="/provider/response/:provider", handler=“home”,action=“response”}

so /socialauth/response/google should go to “socialite/home.response” correct? I’ve tried writedumping rc and instead I just get the text “google” on the page (no html). Can’t figure out where that’s coming from.

In moduleconfig.cfc there’s this.entryPoint = “socialauth”;

SES routes in same contains {pattern="/", handler=“home”,action=“index”},

yet if I go to [site]/socialauth/ I get

“coldbox.system.web.services.HandlerService”,“Invalid Event detected: socialauth. Path info: /socialauth/, query string:”

“handlers.Main”,"The event: socialauth is not valid registered event.

I’ve reloaded modules. Still the same. Coldbox doc say these are auto-loaded (or I think that’s what it says). If I manually add to the apps routes.cfm then of course sees it but … ???

This seems really odd. It says the module name is not valid yet there it is in the list of valid modules…

The module: socialite is not valid. Valid Modules are: cbstorages,cbjavaloader,cbmessagebox,cbdebugger,socialite,cbsecurity,cbantisamy,cbi18n,cbvalidation"

Also does anyone know if this statement from Luis back in 2011 is still true?

“the entry point is for documentation purposes and also for the module debugger to link to your module. Maybe later we can find more uses for it.”

The whole entrypoint thing is driving me crazy. I’m trying to figure out why it’s not working like it seems (to me anyway) that it should.

Thank you!

HI Irvin,

the entrypoint is the base route of the module.

Let’s say you want the module be installed on www.myapp.com/socialauth simply set the entrypoint as “socialauth”. Of course you can use whatever name.

The rest of the setting should not be touched, except the oauth setting where you should put the credentials of the social login. You should put something like this:

`

settings = {
oauth = {
facebook = {
client_id = “XXXXXXXXXXXXXXXXXXXXXXXXX”,
client_secret = “XXXXXXXXXXXXXXXXXXXXXXXXX”,
redirect_url = “http://localhost/socialauth/provider/response/facebook
}
}
};

`

After this simply add a link point to socialauth/facebook or socialauth/google or whatever oauth you like(currently supported also github and linkedin). You will be prompted to facebook login and then back to redirect url:

`
http://localhost/socialauth/provider/response/facebook

`

This is a simple page where you can dump all the credentials. You could use this to authenticate your user.

Hope it helps.

I’ve been 'round and 'round with it for awhile and I have it working - I believe. There’s a couple of issues still that I’ll figure out. They’re probably on my end anyway. That said, if you need for this to work with google and you use Lucee you’ll need version 4.5.2.012+ for this to work. Note this is presently a development release. Has to do with wildcards with http() and the certificate rules. The error you’ll see with 4.5.1.023 is “Host name ‘www.googleapis.com’ does not match the certificate subject provided by the peer (CN=*.storage.googleapis.com, O=Google Inc, L=Mountain View, ST=California, C=US)”. It might work on older versions of Lucee - not sure.

I’ll post back once I’ve tested it all the way thru.

Thanks.

Irv

Thank you!

I just replied without noticing this update in my email. I couldn’t get that entry point to work. Went thru the Coldbox docs to no avail. It seemed to be simply an ignored value. I could put it (the mapping) in routes.cfm and all was fine but that entry in the moduleconfig didn’t appear to do anything. I’ll try it again.

Once I got things going I had issues with google (the one I was using to test with). I just posted about that a minute ago. Is working now that I’m using latest (dev) version of Lucee.

Thanks again!

Irv

Tropicalista,

I set this.entryPoint = “socialauth”;

Then reinitialized everything

I then go to [app]/socialauth/google

error is “The event: socialauth.google is not valid registered event.”

I then found this response by Luis from 4 years ago to a question about “this.entryPoint”. He writes - “the entry point is for documentation purposes and also for the module debugger to link to your module. Maybe later we can find more uses for it.”

I’m thinking this.entryPoint = “socialauth” doesn’t do anything as far as URLs are concerned. It sure appears that way anyway. Are you sure you don’t have “socialauth” set as a path in some other fashion? Sorry to doubt but this just isn’t working for me.

Thanks!

Irv

You should point to “socialauth/provider/{providername}” and set the response url to “socialauth/provider/response/{providername}”

Nope, I get “The event: socialauth.provider is not valid registered event”

I have this - this.entryPoint = “socialauth”;

and this {pattern="/provider/:provider", handler=“home”,action=“auth”},

and the google struct is set up.

reloaded module.

socialauth/provider/google fails with the invalid event message I just sent.

I know I’m set up right on the main functionality because /socialite/home/auth?provider=google works as it should. It’s the routes and the entrypoint entries that are not working.

the this.entryPoint is used for modules to determine their entry point, if you are getting that error then you need to double check the routes are calling handlers and actions that do exist in that module.

{pattern="/provider/:provider", handler=“home”,action=“auth”},

Will become

/socialauth/provider/something/home/auth

I thought “{pattern=”/provider/:provider", handler=“home”,action=“auth”}" within a module with entry point of socialauth would map to

socialauth/home/auth with rc.provider=#:provider#

e.g. /provider/google would be socialauth/home/auth?provider=google

No??

No…

{pattern="/provider/:provider", handler=“home”,action=“auth”}

The pattern is very clear, it is /provider/:provider which means it is going to look for #entryPoint#/provider/#provider# notice I placed cfoutput variables there to expand it out and make it clearer.

But yes, the :provider will create a variable called provider to hold the value entered there.

Sorry I need to clarify, that the :provider is indeed removed from the route, but the /provider will be added to the route and it will look for the home/auth in the route which expans out to

#entrypoint#/provider/home/auth

The url to execute that will be what I said above.

#entrypoint#/provider/somethinghere/home/auth