Spring Social project not running - java

I downloaded the Spring social project from https://github.com/spring-projects/spring-social-samples/tree/master/spring-social-quickstart
When I run the project on Tomcat, after asking for connection and connecting to facebook, the webpage automatically redirects to
http://localhost:8080/spring-social-quickstart/signin?error=provider#=
I am unable to understand the error. can anyone help?
//After Debugging
It is never executing the method in HomeController.java which extracts the friends and return the next page.

Check the followings:
Most probably you are disconnected from Internet. So check your network connectivity.
Ensure you have given correct username and password while connecting to facebook.
Client Id and secret (generally in XML or properties file, you get it when you create your application in facebook / twitter) you use are correct.
Make sure that you have defined a callback url while creating application in facebook / twitter.

Related

authorize an app that uses gmail api deploy using jenkins

I developed a java application that read a gmail inbox folder and proccess the retrieved messages.
I'm using gmail api with Oauth authorization to access this email.
The problem is that I need to use jenkins to deploy this app and at the first time you need to access a browser link to give access to gmail api. any idea how can I solve it?
I tried to send stored credential, but I always receive this message in jenkins console:
Please open the following address in your browser:
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=XXXXXXXXXXXXXXXX.apps.googleusercontent.com&redirect_uri=http://localhost:8888/Callback&response_type=code&scope=https://www.googleapis.com/auth/gmail.modify%20https://www.googleapis.com/auth/drive
Need a solution to deploy this app, there is another authorization type?

Prerender.io not caching pages - followed all steps as per documentation

We are trying to use pretender.io to our application which developed in AngularJS, Spring and Hibernate konnectnow.com which hosted at amazon server.
Here are the steps I followed:
Signup at prerender.io and got token: cFeRZcsv3JnAftreuhMO
Checked documentation and understood that I need to install middleware and decided to use Spring one.
In web.xml added pom added as mentioned https://github.com/greengerong/prerender-java
Added !# to the URL in all the pages.
Restarted tomcat server.
Logged into pretender.io with login details and found that nothing getting crawl.
For testing purpose the url konnectnow.com/#!/planpage changed to konnectnow.com/?_escaped_fragment_=/planpage
Nothing comes up, got error page isn’t working.
Checked Crawl Stats at pretender.io and found that as:
Status Code: 505, Cache Hit: Miss, Response Time(sec): 1.51sec, URL:
http://localhost:8080/#!/planpage
Not sure why it takes local host.
Can some one help me how to make this work.
We recommend using html5 push state instead of the #! in your URLs if possible. Html5 push state is better since nothing after a # is sent to the server, which can lead to issues for the crawlers that are checked by their user agent (Facebook, Twitter, etc).
You should set the forwardedURLHeader in order to have the Prerender Java middleware use a different host for your website instead of your proxy URL.
https://github.com/greengerong/prerender-java#forwardedurlheader
I also see that you posted your prerender token publicly so we regenerated your token to prevent someone else from using it. Please find your new token when you log into your Prerender.io account. I've also emailed you there.

500 server error on App Engine when using OpenID Users API on custom domain

I've encountered an issue with the OpenID option for the users API in Google App Engine that is limited to apps running on a custom domain. When I test my app it works fine in the appspot domain and localhost debugger but crashes on the custom one that I added through the control panel. I managed to get the login with Google Accounts working by asking for the domain to be registered on Google's deprecated OpenID 2 API but the login for any other OpenID account still crashes to an app engine 500 page. It seems that the app engine API just isn't expecting calls from my custom domain.
I can get any screenshots or code snippets that you need to find the issue. I'm also running this in the Java runtime and currently have it in the free quota (so I can't contact Google's support). I did manage to set up a temporary work around for this by redirecting users trying to sign in with non-Google accounts to my appspot domain but this is far from ideal. Any suggestions?
Mihail helped me find a fix for this issue on the App Engine forums here so I figured I'd add it here to help anyone who runs into this issue.
If you append the custom domain name to the URL generation call like this:
String LogInURL = userService.createLoginURL("http://www.example.com/main.jsp", null, openid_URL, null);
It will let the OpenID calls go through on both the custom domain and appspot domain. This will cause the localhost debugger to redirect to your custom domain on login though so it has to be changed to this for debugging:
String LogInURL = userService.createLoginURL("/main.jsp", null, openid_URL, null);

Authorizing App Engine Java Servlet to use Cloud SQL in eclipse

I have written a java servlet in app engine that i am trying to connect to a cloud sql, i am working in eclipse kepler on windows. in the google cloud console i have authorized by app to access the database, they are both stored in the US.
To enable cloud sql for my app in eclipse i am going to google>app engine settings...
i try to configure the cloud sql instance, i am using the appropriate instance name : and i have specified the correct database name username and password, i have also tried with a blank password, and both a blank password and user niether have worked. additionally, i am using the same email account across my database and app engine and eclipse. the error i receive is:
Could not connect to Profile (<project>.GoogleCloudSQL.AppEngineInstance).
Error creating SQL Model Connection connection to
Profile(<project>.GoogleCloudSQL.AppEngineInstance). (Error: Not authorized to access
instance: <instance:database>)
Not authorized to access instance: <instance:database>
Error creating Google Cloud SQL Connection factory connection to Profile
(<project>.GoogleCloudSQL.AppEngineInstance). (Error: Not authorized to access
instance: <instance:database>)
Not authorized to access instance: <instance:database>
i then tried to test the database using the google_sql.sh script provided in the bin folder of the appengine sdk. i sent me to a url to get an authorization code, after entering the authorization code i was just given the script fails stating "the provided authorization grant is invalid, expired, revoked etc.".
i just want my app engine java servlet to be able to access my cloud sql database...does anyone have any advice? a solution? a similar problem?
Please take a look at the following link for the recommended way to connect to your CloudSQL instance from dev purposes.
https://developers.google.com/appengine/docs/java/cloud-sql/#connect_and_post
In short, just get an IP address for the CloudSQL instance using admin API or cloud console, authorize your network to access the CloudSQL instance through Cloud console, and point your application to it.

Facebook Login redirects to localhost

I'm working on a website, which uses the Facebook Login with Spring Social. Currently I playing around with the example for version 3.
On localhost this works as intended. Online however, I get the error message that the redirect URI is invalid. The Site URL in the Facebook app is defined as http://subdomain.domain.net/myapp/. The redirect_uri Facebook sends is http://localhost:8080/myapp/signin (taken from the URL error page parameter). This is the configuration I first used.
I already tried to create a new Facebook app, in case Facebook didn't update the configuration properly. Also I tried to add to the Spring Social ConnectController the application URL. Every time I get the same error.
Turns out I made a simple configuration mistake. I thought it was sufficient to configure the ConnectController, but I missed the ProviderSignInController. Like here in the documentation

Categories