1

通过Railo CFML Engine使用SocialAuth: v2.3,我收到以下异常:

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

这是我的 CFC 代码片段:

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

为什么会抛出这个错误?“configFile”有一个“facebook”属性,它的配置如“入门”指南的第 3 步所示。

我正在使用的配置文件

#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
4

1 回答 1

2

我建议使用 Constants.FACEBOOK 这实际上是“facebook”,但如果它不是它有一个应该起作用的值。

出现错误的一个可能原因是您没有使用正确的输入文件。

确保配置config加载正确,尝试调用config.getProviderConfig(Constants.FACEBOOK)看看是否返回null

最后你可以试试这个。这就是我使用和工作的。

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

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

我真的不知道 Railo CFML Engine 以及它的作用,所以我无能为力。也许.getDefault()config = SocialAuthConfig.getDefault();?

于 2013-03-31T23:12:24.687 回答