Mrjndong / socialauth

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

I have tried my project on localhost #193

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.i have integrated code in my spring mvc
2.i put the consumer key and secret for twitter
3.i 

What is the expected output? What do you see instead?
t 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.springframework.web.servlet.DispatcherServlet | Last-Modified value for 
[/app/socialauth.do] is: -1 | http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.springframework.web.bind.annotation.support.HandlerMethodInvoker | Invoking 
request handler method: private java.lang.String 
org.brickred.socialauth.spring.controller.SocialAuthWebController.connect(java.l
ang.String,javax.servlet.http.HttpServletRequest) throws java.lang.Exception | 
http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.brickred.socialauth.spring.controller.SocialAuthWebController | Getting 
Authentication URL for :twitter | http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory | 
Creating instance of bean 'scopedTarget.socialAuthManager' | http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.springframework.beans.factory.support.AbstractBeanFactory | Returning 
cached instance of singleton bean 'socialAuthConfig' | http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.brickred.socialauth.SocialAuthManager | Setting socialauth config | 
http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.springframework.beans.factory.support.AbstractBeanFactory | Returning 
cached instance of singleton bean 
'org.springframework.transaction.config.internalTransactionAdvisor' | 
http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory | 
Finished creating instance of bean 'scopedTarget.socialAuthManager' | 
http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.brickred.socialauth.SocialAuthManager | Getting Authentication URL for 
provider twitter, with success url : http://socialauth.in/socialauthdemo//app | 
http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**INFO**| 
org.brickred.socialauth.provider.TwitterImpl | Determining URL for redirection 
| http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**INFO**| 
org.brickred.socialauth.oauthstrategy.OAuth1 | Determining URL for redirection 
| http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.brickred.socialauth.oauthstrategy.OAuth1 | Call to fetch Request Token | 
http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | Preparing to get Request Token | 
http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | Given Request Token URL : 
http://api.twitter.com/oauth/request_token | http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | Given CallBack URL : 
http://socialauth.in/socialauthdemo//app | http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | Generating OAUTH Signature | 
http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | Given Signature Type : HMAC-SHA1 | 
http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | Given Method Type : GET | 
http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | Given URL : 
http://api.twitter.com/oauth/request_token | http-9065-4
Sat 07 Jul 12:38:24 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | Given Parameters : 
{oauth_callback=http://socialauth.in/socialauthdemo//app, 
oauth_nonce=1341644904979, oauth_version=1.0, oauth_signature_method=HMAC-SHA1, 
oauth_consumer_key=8prJ8TyiEaJMTck5y6egDA, oauth_timestamp=1341644904} | 
http-9065-4
Sat 07 Jul 12:38:25 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | Signature data : 
GET&http%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3Dhttp%2
53A%252F%252Fsocialauth.in%252Fsocialauthdemo%252F%252Fapp%26oauth_consumer_key%
3D8prJ8TyiEaJMTck5y6egDA%26oauth_nonce%3D1341644904979%26oauth_signature_method%
3DHMAC-SHA1%26oauth_timestamp%3D1341644904%26oauth_version%3D1.0 | http-9065-4
Sat 07 Jul 12:38:25 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | Encoding raw HMAC to Base64 | 
http-9065-4
Sat 07 Jul 12:38:25 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | HMAC-SHA1 Signature for request 
token : ON3qz01qwyWX6x+qBd9fNb+MMUI= | http-9065-4
Sat 07 Jul 12:38:25 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | URL to get Request Token : 
http://api.twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Fsocialaut
h.in%2Fsocialauthdemo%2F%2Fapp&oauth_consumer_key=8prJ8TyiEaJMTck5y6egDA&oauth_n
once=1341644904979&oauth_signature=ON3qz01qwyWX6x%2BqBd9fNb%2BMMUI%3D&oauth_sign
ature_method=HMAC-SHA1&oauth_timestamp=1341644904&oauth_version=1.0 | 
http-9065-4
Sat 07 Jul 12:38:25 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | KEY : 
E5yhz9X0GRzQiafm33YUfDmoV0hg1GuQPssPBzKOY | http-9065-4
Sat 07 Jul 12:38:25 IST 2012|**DEBUG**| 
org.brickred.socialauth.util.OAuthConsumer | SECRET : 
EmXWnTFWqvC1Xs14B9cXPtbj79PCNmVIbrStMdeFc | http-9065-4
Sat 07 Jul 12:38:25 IST 2012|**INFO**| 
org.brickred.socialauth.oauthstrategy.OAuth1 | Redirection to following URL 
should happen : https://api.twitter.com

What version of the product are you using? On what operating system?
on windows operating system, spring 3.0

Please provide any additional information below.
exception

javax.servlet.ServletException: Could not resolve view with name 
'redirect:https://api.twitter.com/oauth/authorize?oauth_token=E5yhz9X0GRzQiafm33
YUfDmoV0hg1GuQPssPBzKOY&oauth_callback=http%3A%2F%2Fsocialauth.in%2Fsocialauthde
mo%2F%2Fapp' in servlet with name 'appServlet'
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1162)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Original issue reported on code.google.com by rose12...@gmail.com on 7 Jul 2012 at 7:09

GoogleCodeExporter commented 8 years ago
Can you please show me your spring configuration file.

It is mandatory to use "socialauth" as a contoller mapping to work with 
socialauth-spring as given below:-

<a href="socialauth.do?id=facebook"><img src="images/facebook_icon.png" 
alt="Facebook" title="Facebook" border="0"></img></a>

But it seems you have changed it to "app"

Regards
Tarun

Original comment by tar...@brickred.com on 9 Jul 2012 at 7:21

GoogleCodeExporter commented 8 years ago
I have created app-social-context.xml and properties.xml file. Imported 
properties.xml in app-social.xml and imported app-social.xml to 
root-context.xml.

I have called root-context.xml file in web.xml
<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:/META-INF/spring/root-context.xml</param-value>
    </context-param>

I was unable to add 
<servlet-mapping>
        <servlet-name>socialauthdemo</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping> in web.xml

I have added rule in urlrewrite.xml as i have it in my project
<rule>
           <from>/socialauthdemo/socialAuthSuccessAction.do</from>
           <to type="redirect">/$1</to>
        </rule>

Still i am getting same error

Original comment by rose12...@gmail.com on 9 Jul 2012 at 8:09

Attachments:

GoogleCodeExporter commented 8 years ago
sociaAuthSuccessAction.do is not a valid path, so rule will not work.

Please check this path..
http://socialauth.in/socialauthdemo//app  
why //app is appending. It should be
http://socialauth.in/socialauthdemo/socialauth

And Why you are using socialauth.in domain. It will not work too because you 
should have application key.secret for this.

Use opensource.brickred.com instead of this because keys on a wiki are 
registered for this domain.

You can run our Sample demo which is in SDK and then match your demo with this.

Regards
Tarun

Original comment by tar...@brickred.com on 10 Jul 2012 at 8:29

GoogleCodeExporter commented 8 years ago
Still i am getting the same error. 

Please find the attached app-social-context.xml which is mapping to app

I have attached error log. 

/app is appending from my app. If you copy the google link available in error 
log and paste it on browser. It rediects the url to some google link where app 
authentication is required.

But why is the lin not rediting to broswer from socialauth side. I smy 
question. I understood that /app is been appending and i am rediecting it in 
apache so no issue. But still i am getting error. Please help me.

Original comment by rose12...@gmail.com on 11 Jul 2012 at 12:05

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Tarun,

I am getting nullpointer exception  manager.getCurrentAuthProvider();

I am using socialauth-2.3.jar and socialauth-spring-2.0-beta2.jar

SEVERE: Servlet.service() for servlet appServlet threw exception
java.lang.NullPointerException
        at com.nii.web.app.controller.SuccessController.setUpForm(SuccessController.java:79)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)

Original comment by rose12...@gmail.com on 16 Jul 2012 at 7:21

GoogleCodeExporter commented 8 years ago
Seems following line returns null manager in your code or you are not getting 
manager like this.
SocialAuthManager manager = socialAuthTemplate.getSocialAuthManager();

If you are getting manager as above then socialAuthTemplate is not in a session 
scope.

Can you please provide me your complete application in zip without lib folder 
and apache mapping file if redirect issue is not resolved.

Regards
Tarun

Original comment by tar...@brickred.com on 16 Jul 2012 at 3:41

GoogleCodeExporter commented 8 years ago
Please re-open this, If you are still facing this issue or let me know if you 
have made some changes to make it work which we should incorporated in our 
application.

Regards
Tarun

Original comment by tar...@brickred.com on 16 Aug 2012 at 4:42

GoogleCodeExporter commented 8 years ago
Hi Tarun,

I am getting nullpointer exception  manager.getCurrentAuthProvider();

please Reply me--

org.springframework.web.util.NestedServletException: Request processing failed; 
nested exception is java.lang.NullPointerException
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
    net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:206)
    net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:179)

root cause

java.lang.NullPointerException
    com.c2b.controller.SocialController.getRedirectURL(SocialController.java:35)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
    org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
    org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
    net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:206)
    net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:179)

Original comment by rsreddy....@gmail.com on 31 Jul 2013 at 6:58

GoogleCodeExporter commented 8 years ago
How you are creating manager object in your controller.
From the given exception, it seems manager object is null. So please verify 
your code to make sure it is not null.

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

GoogleCodeExporter commented 8 years ago
Hello, I have same problem. I have socialauthdemo from examples 
(socialauth-java-sdk-4.7), and when I try to register using Google+ or Facebook 
I got this error:

HTTP Status 500 - Request processing failed; nested exception is 
java.lang.NullPointerException

type Exception report

message Request processing failed; nested exception is 
java.lang.NullPointerException

description The server encountered an internal error that prevented it from 
fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Request processing failed; 
nested exception is java.lang.NullPointerException
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)

root cause

java.lang.NullPointerException
    com.threepillar.labs.socialauthsample.controller.SuccessController.getRedirectURL(SuccessController.java:57)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:606)
    org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
    org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
    org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
    com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)

note The full stack trace of the root cause is available in the Apache 
Tomcat/8.0.9 logs.
Apache Tomcat/8.0.9

When I try to debug, I noticed socialAuthTemplate.getSocialAuthManager() 
returns null.

//SuccessController.java
@RequestMapping(value = "/authSuccess")
public ModelAndView getRedirectURL(final HttpServletRequest request)
            throws Exception {
SocialAuthManager manager = socialAuthTemplate.getSocialAuthManager(); // NULL 
!!

Why is that so? How can I fix it? Shouldnt the SocialAuthManager be saved 
automatically in this demo?

Original comment by JJtu...@gmail.com on 7 Dec 2014 at 9:20

GoogleCodeExporter commented 8 years ago
I just want to add Tomcat log

48130303 22:32:34,376 INFO  
com.threepillar.labs.socialauthsample.controller.HomeController - Showing 
registration page
MonitorFilter::WARNING: the monitor filter must be the first filter in the 
chain.
48144100 22:32:48,173 DEBUG 
org.brickred.socialauth.spring.controller.SocialAuthWebController - Getting 
Authentication URL for :facebook
48144100 22:32:48,173 DEBUG org.brickred.socialauth.SocialAuthManager - Getting 
Authentication URL for provider facebook, with success url : 
http://devpc.com:8024/socialauthdemo/socialauth.do
48144100 22:32:48,173 INFO  org.brickred.socialauth.provider.FacebookImpl - 
Loading plugins
48144100 22:32:48,173 INFO  org.brickred.socialauth.provider.FacebookImpl - 
Loading plugin :: org.brickred.socialauth.plugin.facebook.AlbumsPluginImpl
48144100 22:32:48,173 INFO  org.brickred.socialauth.provider.FacebookImpl - 
Loading plugin :: org.brickred.socialauth.plugin.facebook.FeedPluginImpl
48144100 22:32:48,173 INFO  org.brickred.socialauth.oauthstrategy.OAuth2 - 
Determining URL for redirection
48144100 22:32:48,173 INFO  org.brickred.socialauth.oauthstrategy.OAuth2 - 
Redirection to following URL should happen : 
https://graph.facebook.com/oauth/authorize?client_id=XXXXXXXXXXXXXXXX&response_t
ype=code&redirect_uri=http%3A%2F%2Fdevpc.com%3A8024%2Fsocialauthdemo%2Fsocialaut
h.do&scope=publish_actions,public_profile,email,user_birthday,user_location,user
_photos,user_friends,read_stream
48147921 22:32:51,994 DEBUG 
org.brickred.socialauth.spring.controller.SocialAuthWebController - Unable to 
connect provider because SocialAuthManager object is null.

Also, I have this in webapp/web-INF/socialauthdemo-servlet.xml

    <bean id="socialAuthManager" class="org.brickred.socialauth.spring.bean.SpringSocialAuthManager" scope="session">
        <aop:scoped-proxy/>
    </bean>

    <bean id="socialAuthTemplate" class="org.brickred.socialauth.spring.bean.SocialAuthTemplate" scope="session">
        <aop:scoped-proxy/>
    </bean>

So I guess socialAuthTemplate and SocialAuthManager should be in session scope

Original comment by JJtu...@gmail.com on 7 Dec 2014 at 9:47