Question

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
Was it helpful?

Solution

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();?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top