Allauth package : provider_login_url redirect to /accounts/github/login/ before https://github.com/login/oauth/authorize - django-allauth

I tried to do this tutoriel for Allauth. (https://learndjango.com/tutorials/django-allauth-tutorial).
Allauth work, but i don't understand why there is a intermediate page between signin link and https://github.com/login/oauth/authorize.
Given that i click on signin, i am redirect to /accounts/github/login/ then i must be click on button to redirect to https://github.com/login/oauth/authorize.
Thanks for your help.
First screen Second screen Third screen

If you have the same question, I found my answer. It is necessary to add the following to settings.py:
SOCIALACCOUNT_LOGIN_ON_GET = True

Related

Quickbooks Online - How to implement SSO with intuit in Ruby/Rails

I was able to connect with to Intuit using the Minimul/QboApi gem and get the "Connect to Quickbooks" button working with oauth2 based on the example provided on Github. However neither the gem nor the samples show how to implement single sign on with Intuit. In the example provided by Minimul, the Connect To Quickbooks button is produced by intuit's javascript found at https://appcenter.intuit.com/Content/IA/intuit.ipp.anywhere-1.3.5.js
and a setup script and the tag . The tag appears to have been deprecated. Or at least, it doesn't appear to do anything other than produce the button with the right text and logo on it.
But bottom line, I have been unable to find any documentation on the ipp.anywhere.js package, and not even sure if i's meant to used with oauth2 since it's not mentioned anywhere. I believe that the connect to intuit button does the right things, but the guidelines seem pretty strict about what that the button needs to say the right thing and have th eright logo or they will reject it in the store. They also seem to suggest that users are much more likely to try something if an SSO with Intuit workflow is enabled. Any help appreciated.
After some further work, I figured out a solution that can create a 'log in with Inuit button' , although it's a bit of a javascript hack. First, I determined that the only thing I really needed to change was the button image. In other respects the code behind ` works fine for either a "login with intuit" or "connect to intuit work flow" . The only problem is the button image.
Here is the code (adapted from Minimul/QboApi) to get access and oauth2 refresh tokens via a "Connect to Quickbooks" button.
Setup in the controller code in login or sessions controller:
def new
#app_center = QboApi::APP_CENTER_BASE # "https://appcenter.intuit.com"
state= SecureRandom.uuid.to_s
intuit_id = ENV["CLIENT_ID"]
intuit_secret = ENV["CLIENT_SECRET"]
client = Rack::OAuth2::Client.new(
identifier: intuit_id,
secret: intuit_secret,
redirect_uri: ENV["OAUTH_REDIRECT_URL"],
uthorization_endpoint:"https://appcenter.intuit.com/connect/oauth2",
token_endpoint: "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer",
response_type: "code"
)
#make sure to include at least "openid profile email"
#in the scope to you can retrieve user info.
#uri = client.authorization_uri(scope: 'com.intuit.quickbooks.accounting openid profile email phone address', state: state)
end
Here is the code required to generate the button on the view. (The view needs to load jquery as well in order for the script to work.)
<script type="text/javascript" src="<%= #app_center %>/Content/IA/intuit.ipp.anywhere-1.3.5.js">
</script>
<script>
intuit.ipp.anywhere.setup({
grantUrl: "<%== #uri %>",
datasources: {
quickbooks: true,
payments: false
}
});
</script>
<div>
<ipp:connecttointuit></ipp:connecttointuit>
This code produces the following html on the page delivered to the client:
<ipp:connecttointuit>
Connect with QuickBooks
</ipp:connecttointuit>
This code produces a button with the Connect with QuickBooks image, and an event handler inside intuit.ipp.anywhere-1.3.5.js attaches itself to the click event.
The problem is that the button is styled by the class=intuitPlatformConnectButton attribute inside the generated <a> tag, so if you want a "login with intuit button instead of a connect with intuit button the class on the anchor needs to be changed to class='intuitPlatformLoginButtonHorizontal' but still needs to attach to the event handler defined for <ipp:connecttointuit>. The best solution that doesn't require mucking with intuit.ipp.anywhere is to create the connect button and hide it, and then create another tag styled with class=intuitPlatformLoginButtonHorizontal whose click event calls click on the hidden connect button. I use AngularJs on my login page, so I handle the click with ng-click, but it could be done simply with jquery alone.
new.html.erb:
<div>
</div>
<div>
<ipp:connecttointuit id="connectToIntuit" ng-hide="true">< </ipp:connecttointuit>
</div>
and the controller code:
$scope.intuit_login = function() {
let el = angular.element("#connectToIntuit:first-child")
el[0].firstChild.click();
}
This will result in a redirect upon authentication to the supplied redirect url, where you can use openid to get the user credentials.

Grails 2 with spring security: defaultFailureUrl not working

I'm playing around with the grails 2 framework in addition with the spring-security-plugin.
I built a custom login form, which should be always visible on the main page.
Thus, the user should always be redirected to the main page. Regardless of whether an error occurs or not.
In the case of a successful login everything works very well, but in the case of an error the flash scope is lost during the redirect. So I can't display the reason for the failed authentication.
According to the documentation, only the parameter 'defaultFailureUrl' should be adjusted.
But this doesn't work as expected.
Are there any other parameters necessary to achieve this functionality?
My Config.groovy
// Added by the Spring Security Core plugin:
grails.plugin.springsecurity.successHandler.defaultTargetUrl="/"
grails.plugin.springsecurity.successHandler.alwaysUseDefault=true
grails.plugin.springsecurity.failureHandler.defaultFailureUrl = '/'
grails.plugin.springsecurity.auth.loginFormUrl = '/'
grails.plugin.springsecurity.logout.postOnly = false // Logout through direct link
grails.plugin.springsecurity.userLookup.userDomainClassName = 'de.msg.login.User'
grails.plugin.springsecurity.userLookup.authorityJoinClassName = 'de.msg.login.UserRole'
grails.plugin.springsecurity.authority.className = 'de.msg.login.Role'
I hope someone can figure out a solution ;)
As I understood you want to show the message on same login page after submit the login page.
Use this property probably it will work :
set this in config.groovy
failureHandler.useForward=false
See this link

Timed click link rather than timed redirect

the action I need is after 1 min (and only once, not every minute), a link click is performed, opening the page. I cannot have this as a page redirect. The reason, the test page you can see below, requires a video background to not start over after the 1 minute AND the page opening with instructions to the user.
I need the action to be the same as if the user clicked the link (if they clicked the link, the page would open and the background video would not start over)
http://kartbattle.com/tester - if you click the link on the top right, the page opens but the video doesn't start over....
if you redirect to the page http://kartbattle.com/tester/?page_id=23 the video starts over which I cannot have happen.
thx!
Using javascript:
setTimeout(function(){window.open('http://kartbattle.com/tester', '_self', '', true)}, 60000);
EDIT:
You will still need to use javascript. First add an id attribute to your hyperlink:
<a id="auto-click" href="http://kartbattle.com/tester/?page_id=23">
then add in the following line to your onLoad handler:
setTimeout(document.getElementById('auto-click').click();, 60000);
this should achieve what you are looking for.

Redirection url provoc a lost of information in my url

I'm trying to do a redirection from my host : http://www.carthera.com to http://www.carthera.eu,
Everything looks fine, but when i try to go on another page with carthera.eu I have this :
http://carthera.eu/index.php?page=carthera&ssmenu=0
But with carthera.com I just have the
http://carthera.com
Does anyone know where it comes from and how can i fix this ?
Thanks a lot!
For information, the problem was that the host used an Iframe to display carthera.com. So basically when I went on carthera.com, I would have an iframe with carthera.eu. So the information for the get are not displayed in carthera.com but in the iframe carthera.eu ...

How to load the page as popup dialog without specifying "data-rel" in the caller link

Hi i'm new to Jquery mobile,have some servlet which evaluates username and password from login.html page as,
if(un.equals("user1") && pd.equals("password1")){
RequestDispatcher rd=request.getRequestDispatcher("welcome.html");
rd.forward(request, response);}
else {
RequestDispatcher rd=request.getRequestDispatcher("loginfailed.html");
rd.forward(request, response);}
}
i
what i'm trying is when login fails loginfailed.html should open as a popup dialog showing login failure notice example here. Pls help me to do this..
I've been using this:
http://dev.jtsage.com/jQM-SimpleDialog/
Much easier to open from within javascript than the default jquery-mobile dialog, plus it looks like a dialog in that it does not take up the whole page.

Resources