Yahoo: Why do I get error=provider - spring-social

I am trying add Yahoo social sign in into my Spring web app. I have the following HTML:
<form id="yh_signin" method="POST" action="/signin/yahoo">
<input type="hidden" name="scope" value="email" />
<button type="submit" class="btn btn-yahoo">
Yahoo
</button>
</form>
the following java:
registry.addConnectionFactory(new YahooConnectionFactory(config.getProperty("yahoo.clientId"),
config.getProperty("yahoo.clientSecret")));
the following in pom.xml:
<dependency>
<groupId>com.github.gabrielruiu</groupId>
<artifactId>spring-social-yahoo</artifactId>
<version>1.0.0.RELEASE</version>
</dependency>
I am doing the same thing for Facebook and Google. They both work well. However, the same approach does not work for Yahoo and I always get the error in URL:
/siginin?error=provider
What I did is wrong?

Related

Changing Google CSE custom search from http to https

I am using Google Custom Search box with below code
<div class="cse">
<form action="http://www.google.com/cse" id="cse-search-box">
<div>
<input type="hidden" name="cx" value="xxxxxxxxxx" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" size="30" />
<input type="submit" name="sa" value="Search" />
</div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script></td></p>
</div>
However as now going to shift all pages to https - has to replace the code
<div class="cse">
<form action="https://cse.google.com/cse" id="cse-search-box">
<div>
<input type="hidden" name="cx" value="xxxxxxxxxx" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" size="30" />
<input type="submit" name="sa" value="Search" />
</div>
</form>
<script type="text/javascript" src="https://cse.google.com/cse.js?cx=' + cx/brand?form=cse-search-box&lang=en"></script></td></p>
</div>
Can anyone help and assist if the above modified code is correct
That seems like it should work, but you should consider switching to the Custom Search Element --- It's the modern, supported way to use Google Custom Search

Conditional rendering in Spring in Action 4

I've been working on an example on conditional rendering from Spring in Action 4.
The code looks this way:
<sec:authorize access="hasRole('ROLE_SPITTER')">
<s:url value="/spittles" var="spittle_url" />
<sf:form modelAttribute="spittle" action="${spittle_url}">`
<sf:label path="text"><s:message code="label.spittle" text="Enter spittle:"/> </sf:label>
<sf:textarea path="text" rows="2" cols="40" />
<sf:errors path="text" />
<br/>
<div class="spitItSubmitIt">
<input type="submit" value="Spit it!" class="status-btn round-btn disabled" />
</div>
</sf:form>
</sec:authorize>
The question is what does the code attribute, namely label.spittle refers to? Does it refer to the modelAttribute from the form? Or does it mean that there should be message bundle with key label.spittle?
It means a key in a resource bundle (documentation):
<s:message code="label.spittle" text="Enter spittle:"/>

how to call two submit buttons in spring form, one calls j_spring_security_check and another one calling controller method

How to call two submit buttons in spring form,
one button calls j_spring_security_check and another button one calling controller method.
following is login form
<form action="../../j_spring_security_check" method="post" >
<div class="right">
<ul>
<li>
<spring:message code="label.userName" text="UserName" />
<input id="j_username" name="j_username" type="text" />
<form:errors path="firstName" cssclass="error"> </form:errors>
</li>
<li>
<spring:message code="label.password" text="Password" />
<input id="j_password" name="j_password" type="password" />
<form:errors path="password" cssclass="error"></form:errors>
</li>
<li>
<input type="submit" value="Login" />
</li>
</ul>
</div>
</form>
<form action="/portal/main/resetForgetPassword" method="POST">
<input type="submit" value="ForgetPassword">
</form>
thanks advance
I guess your problem is that for every URL it is going to Security form of spring.
So you need to permit for some url so that it should not go to j_spring_security_check
You can do this in the security.xml (whatever may be the name of that file).
<intercept-url pattern="/portal/main/forgetPassword*" access="permitAll" />
<intercept-url pattern="/*" access="hasRole('ROLE_ADMIN_ASSUMED')">
And also in your html code
Forget Password

Embed Spring Security login form to an existing page

How do I add the spring security login form to an existing page?
For example, let's say I have the following test.jsp page (which is not a spring login form page):
<html>
<head>Existing Page</head>
<body>
<div id="login-form"></div>
</body>
</html>
I would like to add the login form configured in my spring-security.xml inside the login-form div.
Typically I believe people just put the form right in the page (i.e. within the div you have there.) Something like:
<form id="blah" action="/j_spring_security_check">
<input type="text" name="j_username" />
<input type="text" name="j_password" />
<input type="submit" name="submit" value="login" />
<input type="reset" name="reset" />
</form>
Then use your css to make it fit the look and feel of the rest of your application.

How can I redirect a customer back to my website after a successful payment with Google Checkout?

I am doing a shopping cart with Google Checkout. I integrated Paypal already like below:
<form name="frmpay" method="post" action="success.php">
<input type="hidden" name="business" value="" />
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="image_url" value="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" />
<input type="hidden" name="return" value="success.php" />
<input type="hidden" name="cancel_return" value="error.php" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="lc" value="UK" />
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="item_name" value="<?=$res_item[name]?>" />
<input type="hidden" name="amount" value="<?=$_SESSION['amt']?>" />
<?php /*?><input type="hidden" name="shipping" value="<?=$_POST["shipping"]?>" /><?php */?>
<input type="hidden" name="quantity" value="1" />
</form>
How can I integrate Google Checkout like this? How can I return success page after payment in Google checkout? What is the input type for redirect url after successful payment in Google Checkout? I tried a lot for this but I did not get anywhere.
Here is my code:
<form method="POST" action="https://sandbox.google.com/checkout/api/checkout/v2/checkoutForm/Merchant/REPLACE_WITH_YOUR_SANDBOX_MERCHANT_ID" accept-charset="utf-8">
<!-- No product -->
<!-- No tax code -->
<!-- No shipping code -->
<input type="hidden" name="_charset_" />
<!-- Button code -->
<input type="image"
name="Google Checkout"
alt="Fast checkout through Google"
src="http://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=REPLACE_WITH_YOUR_SANDBOX_MERCHANT_ID&w=180&h=46&style=white&variant=text&loc=en_US"
height="46"
width="180" />
</form>
There is no automatic re-direct for the buyer after the Google Checkout transaction finishes. However, you can provide a link that the user can click and get back to your site after completing the order.
See the continue_url paramenter:
http://code.google.com/apis/checkout/developer/Google_Checkout_HTML_API_Parameter_Reference.html#tag_continue-shopping-url
I have the same problem.
My rough variant is to sell a link to a user, and after the user has successfully paid for the link, he will be redirected to the "thank you" page on Google Checkout, where he will see my link and a message from me, then he clicks on the link and gets back to my site
A link looks like mysite.com/orderhasbeenpayd/1342
but as I said it is a rough variant

Resources