emonarafat / socialauth-net

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

Different behavior on Azure - localhost #148

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. navigate to http://truliing.cloudapp.net/default.aspx? (Azure hosted service)
2. click the facebook button

What is the expected output? What do you see instead?
the app stays in default.aspx instead going to the DefaultUrl page specified in 
web.config: loginorsignup.aspx 

What version of the product are you using? On what operating system?
windows 7, visual studio 2012 and incorrect behavior on Azure

Please provide any additional information below.

The web application "start page" is default.aspx, wich presents the "login with 
FB" button. After clicking on it, the web flows to loginorsignup.aspx, when an 
additional application-scope password should be entered, or perform a sign up 
on the application.

These are the relevant parts of the web.config file:
 <SocialAuthConfiguration>
    <Authentication Enabled="true" LoginUrl="default.aspx" DefaultUrl="loginorsignup.aspx" />
</SocialAuthConfiguration>

<system.web>
 <authorization>
      <deny users="?" />
    </authorization>
...
<membership defaultProvider="TruliingSqlMembershipProvider">
      <providers>
        <!--Add a customized SqlMembershipProvider -->
        <add name="TruliingSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="Truliing" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
      </providers>
    </membership>
  </system.web>

The membership provider is needed to store extra user information after the 
sign up has been performed on the application.

The flow in localhost is as expected:
default.aspx --->[FB clicked]----> loginorsignup.aspx
The localhost site is executed via the internal VS development server (under 
project properties/web/servers)

But in Azure the web flows redirects to 
default.aspx?ReturnUrl=%2fsocialauth%2fvalidate.sauth%3fcode%XXXXXXXXXX and 
stays there. IIS Authentication in Azure had to be set to "anonymous 
authentication enabled" and "forms authetication enabled" in order to avoid a 
401.2 error

Any ideas?

Original issue reported on code.google.com by jonayre...@gmail.com on 18 Dec 2012 at 2:06

GoogleCodeExporter commented 9 years ago
Likely, you're missing following:

<location path="SocialAuth">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
</location>

Deepak

Original comment by l...@3pillarglobal.com on 19 Dec 2012 at 6:31

GoogleCodeExporter commented 9 years ago
Thanks for your response.

The solution seems to be working partially: now the web flows DOESN'T redirect 
to to default.aspx?ReturnUrl=%2fsocialauth%2fvalidate.sauth%3fcode%XXXXXXXXXX 

...but it redirects again to default.aspx

even more: if I try to access manually 
http://truliing.cloudapp.net/loginorsignup.aspx (the next step after validation 
occurs), it falls back again to 
http://truliing.cloudapp.net/default.aspx?ReturnUrl=%2floginorsignup.aspx

This behavour happens with any script I manually try to access

Thanks again!

Original comment by jonayre...@gmail.com on 19 Dec 2012 at 9:56

GoogleCodeExporter commented 9 years ago
Could you share your web.config? You may replace consumer key/secret with dummy 
values if you chose not to share them. Just want to ensure your web.config is 
configured properly for SocialAuth.NET

Deepak

Original comment by deepakag...@gmail.com on 19 Dec 2012 at 11:56

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
(edited)

Of course, here it is:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!--<section name="SocialAuthConfiguration" type="Brickred.SocialAuth.NET.Core.SocialAuthConfiguration, SocialAuth-net, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null" allowDefinition="Everywhere" allowLocation="true" />-->
    <section name="SocialAuthConfiguration" type="Brickred.SocialAuth.NET.Core.SocialAuthConfiguration,SocialAuth-net,Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" allowDefinition="Everywhere" allowLocation="true" />
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <add key="pruebas" value="1" />
  </appSettings>
  <!-- Social Auth Configuration-->
  <SocialAuthConfiguration>
    <Providers>
      <!--NO SCOPE-->
      <!--<add ScopeLevel="CUSTOM" WrapperName="FacebookWrapper"  ConsumerKey="152190004803645" ConsumerSecret="64c94bd02180b0ade85889b44b2ba7c4" />
      <add ScopeLevel="CUSTOM" WrapperName="GoogleWrapper"    ConsumerKey="opensource.brickred.com" ConsumerSecret="YC06FqhmCLWvtBg/O4W/aJfj"  />
      <add ScopeLevel="CUSTOM" WrapperName="MSNWrapper"       ConsumerKey="000000004403D60E" ConsumerSecret="cYqlii67pTvgPD4pdB7NUVC7L4MIHCcs"  />
      <add ScopeLevel="CUSTOM" WrapperName="TwitterWrapper"   ConsumerKey="E3hm7J9IQbWLijpiQG7W8Q" ConsumerSecret="SGKNuXyybt0iDdgsuzVbFHOaemV7V6pr0wKwbaT2MH0" />
      <add ScopeLevel="CUSTOM" WrapperName="LinkedInWrapper"  ConsumerKey="9-mmqg28fpMocVuAg87exH-RXKs70yms52GSFIqkZN25S3m96kdPGBbuSxdSBIyL" ConsumerSecret="e6NBqhDYE1fX17RwYGW5vMp25Cvh7Sbw9t-zMYTIW_T5LytY5OwJ12snh_YftgE4" />
      <add ScopeLevel="CUSTOM" WrapperName="MySpaceWrapper"   ConsumerKey="29db395f5ee8426bb90b1db65c91c956" ConsumerSecret="0fdccc829c474e42867e16b68cda37a4c4b7b08eda574fe6a959943e3e9be709" />-->
      <!--DEFAULT-->
      <add WrapperName="FacebookWrapper" ConsumerKey="xxx" ConsumerSecret="xxx" AdditionalScopes="xxx" />
      <!--<add  WrapperName="GoogleWrapper" ConsumerKey="opensource.brickred.com" ConsumerSecret="YC06FqhmCLWvtBg/O4W/aJfj"  AdditionalScopes=https://www.googleapis.com/auth/userinfo.profile" />-->
      <!--<add  WrapperName="MSNWrapper" ConsumerKey="000000004403D60E" ConsumerSecret="cYqlii67pTvgPD4pdB7NUVC7L4MIHCcs" AdditionalScopes=""  />-->
      <!--<add  WrapperName="YahooWrapper" ConsumerKey="dj0yJmk9VTdaSUVTU3RrWlRzJmQ9WVdrOWNtSjZNMFpITm1VbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1iMA escapar guionguion" ConsumerSecret="1db3d0b897dac60e151aa9e2499fcb2a6b474546"  />-->
      <!--<add  WrapperName="TwitterWrapper" ConsumerKey="E3hm7J9IQbWLijpiQG7W8Q" ConsumerSecret="SGKNuXyybt0iDdgsuzVbFHOaemV7V6pr0wKwbaT2MH0" />-->
      <!--<add  WrapperName="LinkedInWrapper" ConsumerKey="9-mmqg28fpMocVuAg87exH-RXKs70yms52GSFIqkZN25S3m96kdPGBbuSxdSBIyL" ConsumerSecret="e6NBqhDYE1fX17RwYGW5vMp25Cvh7Sbw9t-zMYTIW_T5LytY5OwJ12snh_YftgE4" />-->
      <!--<add  WrapperName="MySpaceWrapper" ConsumerKey="29db395f5ee8426bb90b1db65c91c956" ConsumerSecret="0fdccc829c474e42867e16b68cda37a4c4b7b08eda574fe6a959943e3e9be709" />-->
    </Providers>
    <Allow Files="popupdemo.aspx|GetToken.aspx|ManualLogin.aspx" />
    <IconFolder Path="~/images/SocialAuthIcons/" />
    <Authentication Enabled="true" LoginUrl="default.aspx" DefaultUrl="loginorsignup.aspx" />
  </SocialAuthConfiguration>
  <!--<log4net>
    <appender name="FileAppender" type="log4net.Appender.FileAppender">
      <file value="c:\log.txt" />
      <appendToFile value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date     [%property{SessionID}]  %-5level    %logger %message%newline" />
      </layout>
    </appender>
    -->
  <!-- Set root logger level to DEBUG and its only appender to A1 -->
  <!--
    <root>
      <level value="ALL" />
      <appender-ref ref="FileAppender" />
    </root>
  </log4net>-->
  <!--Required for internal purpose -->
  <location path="SocialAuth">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>

   <!-- <location path="ManualLogin.aspx">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>-->
  <connectionStrings>
    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=sxxx" />
    <add name="xxx" connectionString="xxx" />
  </connectionStrings>
  <system.web>
    <sessionState mode="InProc" timeout="60" />

    <customErrors mode="Off" />
    <!--<authentication mode="Forms">
      <forms loginUrl="ManualLogin.aspx" defaultUrl="welcome.aspx"/>
    </authentication>-->
    <!--<authentication mode="None"/>-->
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
    <httpHandlers>
      <add verb="*" path="*.sauth" type="Brickred.SocialAuth.NET.Core.CallbackHandler" />
    </httpHandlers>
    <httpModules>
      <add name="SocialAuthAuthentication" type="Brickred.SocialAuth.NET.Core.SocialAuthHttpModule" />
    </httpModules>
    <membership defaultProvider="TruliingSqlMembershipProvider">
      <providers>
        <!--Add a customized SqlMembershipProvider -->
        <add name="TruliingSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="Truliing" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
      </providers>
    </membership>
  </system.web>
  <system.net>
    <mailSettings>

    </mailSettings>
  </system.net>
  <!--IIS7 Support-->
  <system.webServer>
      <security>
          <authentication>
              <!--<windowsAuthentication enabled="false" />-->
          </authentication>
      </security>
      <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add name="socialAuth.NET" verb="*" path="*.sauth" type="Brickred.SocialAuth.NET.Core.CallbackHandler" />
    </handlers>
    <modules>
      <add name="SocialAuthAuthentication" type="Brickred.SocialAuth.NET.Core.SocialAuthHttpModule" />
    </modules>
  </system.webServer>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration>

Original comment by jonayre...@gmail.com on 19 Dec 2012 at 12:08

GoogleCodeExporter commented 9 years ago
Thanks for config.
Which authentication are you willing to use for your application?

SocialAuth.NET internal authentication OR Forms based authentication with 
socialauth.net support?

Deepak

Original comment by deepakag...@gmail.com on 19 Dec 2012 at 12:15