jnorthr / socialauth

Automatically exported from code.google.com/p/socialauth
0 stars 0 forks source link

Various Provider IDs not working #282

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
entering String site = "facebook", "foursquare" or "hotmail"  into 

> manager.getAuthenticationUrl(site, "www.myapp.com") returns a valid URL, but 
entering "google", "twitter", "aol", "linkedin", and "myspace" returns a 
java.net.MalformedURLException: no protocol.

I am using the demo "oauth_consumer.properties" file and typing in the provider 
ID as typed above.  Is this correct syntax?

What is the expected output? What do you see instead?

Expected output is a valid oauth validation URL, but I am seeing "no protocol" 
errors instead when entering some provider IDs but not others.

What version of the product are you using? On what operating system?

I am using        "org.brickred" % "socialauth" % "4.2" 
in a scalatra webapp on a Mac 10.8

Original issue reported on code.google.com by alex2awe...@gmail.com on 26 Jul 2013 at 5:47

GoogleCodeExporter commented 8 years ago
I'm not sure if this helps, but I went deeper into the code and tried to do a 
workaround.  When I did:

val face = config.getProviderConfig("facebook")
val x = new FacebookImpl(face)
x.getLoginRedirectURL("www.myapp.com")

The correct redirection information was provided.

However, when I did:

val goog = config.getProviderConfig("google")
val y = new GoogleImpl(goog)
y.getLoginRedirectURL("www.myapp.com")

I got:

org.brickred.socialauth.exception.SocialAuthException: 
java.net.MalformedURLException: no protocol: 
/accounts/OAuthGetRequestToken?openid.assoc_type=HMAC-SHA1&openid.mode=associate
&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.session_type=no-enc
ryption
Even though 

Original comment by alex2awe...@gmail.com on 26 Jul 2013 at 7:35

GoogleCodeExporter commented 8 years ago
I'm pretty sure its a problem in the file:

socialauth-core/src/main/java/org/brickred/socialauth/util/Constants.java

but I can't even begin to understand what...

Original comment by alex2awe...@gmail.com on 26 Jul 2013 at 7:54

GoogleCodeExporter commented 8 years ago
Just a thought...
Are you sure the lines:

                ENDPOINTS.put(Constants.OAUTH_REQUEST_TOKEN_URL,
                                "https://www.google.com/accounts/o8/ud");
                ENDPOINTS.put(Constants.OAUTH_ACCESS_TOKEN_URL,
                                "https://www.google.com/accounts/OAuthGetAccessToken");

in socialauth-core/src/main/java/org/brickred/socialauth/provider/GoogleImp

are correct and updated?  

Original comment by alex2awe...@gmail.com on 26 Jul 2013 at 8:03

GoogleCodeExporter commented 8 years ago
Yes it is updated.
I don't know why it is removing domain while returning a URL. Is it possible 
for you to trace log details and show me.

Original comment by tarun.na...@3pillarglobal.com on 29 Jul 2013 at 4:44

GoogleCodeExporter commented 8 years ago
Sure, here is the trace stack for "google":

scala> manager.getAuthenticationUrl("google", "http://www.abc.com")
Jul 29, 2013 1:54:29 PM org.brickred.socialauth.AbstractProvider registerPlugins
INFO: Loading plugins
org.brickred.socialauth.exception.SocialAuthException: 
java.net.MalformedURLException: no protocol: 
/accounts/OAuthGetRequestToken?openid.assoc_type=HMAC-SHA1&openid.mode=associate
&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.session_type=no-enc
ryption
    at org.brickred.socialauth.util.HttpUtil.doHttpRequest(HttpUtil.java:220)
    at org.brickred.socialauth.oauthstrategy.Hybrid.getLoginRedirectURL(Hybrid.java:73)
    at org.brickred.socialauth.provider.GoogleImpl.getLoginRedirectURL(GoogleImpl.java:143)
    at org.brickred.socialauth.SocialAuthManager.getAuthURL(SocialAuthManager.java:162)
    at org.brickred.socialauth.SocialAuthManager.getAuthenticationUrl(SocialAuthManager.java:116)
    at .<init>(<console>:13)
    at .<clinit>(<console>)
    at .<init>(<console>:7)
    at .<clinit>(<console>)
    at $print(<console>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:734)
    at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:983)
    at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:573)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:604)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:568)
    at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:745)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:790)
    at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:702)
    at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:566)
    at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:573)
    at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:576)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:867)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
    at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
    at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
    at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:889)
    at xsbt.ConsoleInterface.run(ConsoleInterface.scala:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)
    at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:64)
    at sbt.Console.console0$1(Console.scala:23)
    at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:24)
    at sbt.TrapExit$.executeMain$1(TrapExit.scala:33)
    at sbt.TrapExit$$anon$1.run(TrapExit.scala:42)
Caused by: java.net.MalformedURLException: no protocol: 
/accounts/OAuthGetRequestToken?openid.assoc_type=HMAC-SHA1&openid.mode=associate
&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.session_type=no-enc
ryption
    at java.net.URL.<init>(URL.java:567)
    at java.net.URL.<init>(URL.java:464)
    at java.net.URL.<init>(URL.java:413)
    at org.brickred.socialauth.util.HttpUtil.doHttpRequest(HttpUtil.java:177)
    ... 41 more

in comparison to "facebook", which returns this:

scala> manager.getAuthenticationUrl("facebook", "www.abc.com")
Jul 29, 2013 1:52:09 PM org.brickred.socialauth.AbstractProvider registerPlugins
INFO: Loading plugins
Jul 29, 2013 1:52:09 PM org.brickred.socialauth.AbstractProvider registerPlugins
INFO: Loading plugin :: org.brickred.socialauth.plugin.facebook.AlbumsPluginImpl
Jul 29, 2013 1:52:09 PM org.brickred.socialauth.AbstractProvider registerPlugins
INFO: Loading plugin :: org.brickred.socialauth.plugin.facebook.FeedPluginImpl
Jul 29, 2013 1:52:09 PM org.brickred.socialauth.oauthstrategy.OAuth2 
getLoginRedirectURL
INFO: Determining URL for redirection
Jul 29, 2013 1:52:09 PM org.brickred.socialauth.oauthstrategy.OAuth2 
getLoginRedirectURL
INFO: Redirection to following URL should happen : 
https://graph.facebook.com/oauth/authorize?client_id=4d965afccc4d86c598dbf5d94fb
34a7c&response_type=code&redirect_uri=www.abc.com&scope=publish_stream,email,use
r_birthday,user_location,user_photos
res2: String = 
https://graph.facebook.com/oauth/authorize?client_id=4d965afccc4d86c598dbf5d94fb
34a7c&response_type=code&redirect_uri=www.abc.com&scope=publish_stream,email,use
r_birthday,user_location,user_photos

Original comment by alex2awe...@gmail.com on 29 Jul 2013 at 6:01

GoogleCodeExporter commented 8 years ago
I installed the following libraryDependencies to my build.scala file:

        "org.brickred" % "socialauth" % "4.2",
        "org.brickred" % "socialauth-cdi" % "2.1",

I manually installed the following .jar files:

      commons-logging-1.1.jar
      json-20090211.jar
     openid4java-consumer-0.9.5.jar

Original comment by alex2awe...@gmail.com on 29 Jul 2013 at 6:03

GoogleCodeExporter commented 8 years ago
Not sure why are you facing this issue.

please include openid4java-nodeps-0.9.5.jar in your project and try again.

Otherwise send me your source code I'll try to find out the reason of this.

Regards
Tarun

Original comment by tarun.na...@3pillarglobal.com on 2 Aug 2013 at 10:10

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I figured out the problem.  I copied a oauth_consumer.properties file over from 
an example that had extraneous information:

ex) 

#google
www.google.com.consumer_key = www.myapp.com
www.google.com.consumer_secret = XXXXX
#www.google.com.secure = true
#www.google.com.request_token_url = /accounts/OAuthGetRequestToken
#www.google.com.authorization_url = /accounts/OAuthAuthorizeToken
#www.google.com.access_token_url = /accounts/OAuthGetAccessToken
#www.google.com.signature_method = HMAC-SHA1
#www.google.com.transport_name = POST

Once this information was commented out, the redirection URL was successfully 
generated.

Original comment by alex2awe...@gmail.com on 5 Aug 2013 at 8:52

GoogleCodeExporter commented 8 years ago
Hi Alex

Can you please let me know from which example you copied this file.

Regards
Tarun

Original comment by tarun.na...@3pillarglobal.com on 9 Aug 2013 at 9:10

GoogleCodeExporter commented 8 years ago

Original comment by tarun.na...@3pillarglobal.com on 29 Aug 2013 at 3:12