1

Using SocialAuth: v2.3 via Railo CFML Engine, I am getting the following exception thrown:

Railo 3.3.4.003 Error (org.brickred.socialauth.exception.SocialAuthException)
Message     facebook is not a provider or valid OpenId URL
Cause   org.brickred.socialauth.exception.SocialAuthException
Stacktrace  The Error Occurred in
/Users/rountrjf/Sites/ccpd-dev/controllers/socialauth.cfc: line 31

    29: manager.setSocialAuthConfig(config);
    30: successUrl = "http://dev.ccpd.uc.edu/socialauth/success";
    31: providerUrl = manager.getAuthenticationUrl("facebook", successUrl);

Here is a snippet of my CFC code:

public string function login() {
    id = params.key;
    configFile = expandPath("/SocialAuth/oauth_config.properties");
    inputFile = createObject("java","java.io.File").init(configFile);
    inputStream = createObject("java", "java.io.FileInputStream").init(inputFile);

    SocialAuthConfig = createObject("java","org.brickred.socialauth.SocialAuthConfig").init();
    config = SocialAuthConfig.getDefault();
    config.load(configFile);

    SocialAuthManager = createObject("java","org.brickred.socialauth.SocialAuthManager").init();
    manager = SocialAuthManager;
    manager.setSocialAuthConfig(config);
    successUrl = "http://dev.ccpd.uc.edu/socialauth/success";
    providerUrl = manager.getAuthenticationUrl("facebook", successUrl);

Why is it throwing this error? The "configFile" has a property for "facebook" and it configured as shown in step 3 of the "Getting Started" guide.

CONFIG FILE I'M USING

#google
www.google.com.consumer_key = opensource.brickred.com
www.google.com.consumer_secret = YC06FqhmCLWvtBg/O4W/aJfj
#you can set custom permission by using custom_permissions with provider prefix.
#www.google.com.custom_permissions = http://www.google.com/m8/feeds/,http://picasaweb.google.com/data/

#yahoo 
api.login.yahoo.com.consumer_key = dj0yJmk9VTdaSUVTU3RrWlRzJmQ9WVdrOWNtSjZNMFpITm1VbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1iMA--
api.login.yahoo.com.consumer_secret = 1db3d0b897dac60e151aa9e2499fcb2a6b474546

#twitter
twitter.com.consumer_key = E3hm7J9IQbWLijpiQG7W8Q
twitter.com.consumer_secret = SGKNuXyybt0iDdgsuzVbFHOaemV7V6pr0wKwbaT2MH0

#facebook
graph.facebook.com.consumer_key =       152190004803645
graph.facebook.com.consumer_secret = 64c94bd02180b0ade85889b44b2ba7c4
#you can set custom permission by using custom_permissions with provider prefix.
#graph.facebook.com.custom_permission = publish_stream,email,user_birthday,user_location,offline_access

#hotmail
consent.live.com.consumer_key = 000000004403D60E
consent.live.com.consumer_secret = cYqlii67pTvgPD4pdB7NUVC7L4MIHCcs

#AOL
api.screenname.aol.com.consumer_key = ab1QxoYXlT-x-ARL
api.screenname.aol.com.consumer_secret = 000

#LinkedIn
api.linkedin.com.consumer_key = 9-mmqg28fpMocVuAg87exH-RXKs70yms52GSFIqkZN25S3m96kdPGBbuSxdSBIyL
api.linkedin.com.consumer_secret = e6NBqhDYE1fX17RwYGW5vMp25Cvh7Sbw9t-zMYTIW_T5LytY5OwJ12snh_YftgE4

#MySpace
api.myspace.com.consumer_key = 29db395f5ee8426bb90b1db65c91c956
api.myspace.com.consumer_secret = 0fdccc829c474e42867e16b68cda37a4c4b7b08eda574fe6a959943e3e9be709

#FourSquare
foursquare.com.consumer_key = JQKEM1PHWFW4YF2YPEQBRRESXE3SBGNCYJWWDTZKF3IZNJ3V
foursquare.com.consumer_secret = 4IILLDFDVPP2LC554S4KXKETQNTDKPDSEVCKVHA2QEHKYBEQ

#Yammer
www.yammer.com.consumer_key=5zyIkp12TrkulSRbSegQ
www.yammer.com.consumer_secret=zUcCB9kqWhI1IiTAJbl9QdG2AWcUJMDWp3Qyv5VJJw

#Mendeley
api.mendeley.com.consumer_key=f31077a7576d5e02537e232eb649403c04fce1dd0
api.mendeley.com.consumer_secret=1810bc92d4625f673e4ff35cb248aab3

#Salesforce
login.salesforce.com.consumer_key = 3MVG9Y6d_Btp4xp4yFMR0tPSndkAVu4OBejuYcL2iGFC68tA49PknWKX20XdPl5s1iwWldyuAbSINWHbB2Jcu
login.salesforce.com.consumer_secret = 1993703471433041656
Joshua F. Rountree
  • 1,462
  • 2
  • 14
  • 30
  • 2
    I don't know anything about SocialAuth, but the error message _"facebook is not a provider or valid OpenId URL"_ seems to be pretty explicit, so what's your question? – Peter Boughton Aug 15 '12 at 17:22
  • Okay, sorry about that - I added my question at the bottom. – Joshua F. Rountree Aug 15 '12 at 19:02
  • It _"should be"_ configured as the guide shows, or it ***is*** configured as the guide shows? What happens if you specify the relevant URL instead? – Peter Boughton Aug 15 '12 at 19:28
  • Well, the guide is for general Java usage but I'm using ColdFusion so the code isn't 1:1... Please see: http://code.google.com/p/socialauth/wiki/GettingStartedWithYourOwnFramework – Joshua F. Rountree Aug 15 '12 at 19:38
  • So what do you have for the `#facebook` section of your file? Include the `#facebook` header and redact the key values so we don't see them :). – Dan Short Aug 15 '12 at 19:50
  • You're not using ColdFusion you're using Railo CFML. The _call_ to manager.getAuthenticationUrl is 1:1 because it's a method call involving two strings. The [**code where the error is thrown**](http://code.google.com/searchframe#YZcohgpbWlo/trunk/socialauth-core/src/org/brickred/socialauth/AuthProviderFactory.java&l=239) is straightforward - you need to end up with a string containing a valid URL. Therefore, if you're specifying just "facebook" this must somewhere be converted to a URL. Post your config where this is happening and/or change the value to Facebook's actual OpenID URL. – Peter Boughton Aug 15 '12 at 19:54
  • There's a [sample config file here](http://code.google.com/p/socialauth/wiki/SampleProperties) - what happens if you temporarily replace your one with that - does this error go away? If so, your config file is the issue, if not, something else is the issue. – Peter Boughton Aug 15 '12 at 20:02
  • @PeterBoughton The config file I'm using is the sample config file. I didn't change one thing about it... :-\ Also, I say "ColdFusion" because that's the popular name for it, but Railo should behave very closely if not exactly the same as Adobe's in this aspect. – Joshua F. Rountree Aug 16 '12 at 16:43

1 Answers1

2

I would suggest using Constants.FACEBOOK which is actually "facebook" but in case it isn't it has a value that should work.

A possible reason that the error appears is that you are not using the correct input file.

Make sure that the configuration config is loaded correctly, try to call config.getProviderConfig(Constants.FACEBOOK) and see if it returns null

Lastly you can try this. This is what I used and works.

SocialAuthConfig config = new SocialAuthConfig();
SocialAuthManager socialAuthManager = new SocialAuthManager();

config.load(inputStream);
socialAuthManager.setSocialAuthConfig(config);

I don't really know Railo CFML Engine and what it does so I can't help. Maybe remove .getDefault() from config = SocialAuthConfig.getDefault();?

kon psych
  • 626
  • 1
  • 11
  • 26