Coder Social home page Coder Social logo

Comments (8)

titarenko avatar titarenko commented on September 26, 2024

Hi,

Could you please add more details on this exception? Maybe FieldName or Response property value? Thanks!

from oauth2.

samz-me avatar samz-me commented on September 26, 2024

OAuth2.Client.UnexpectedResponseException was unhandled by user code
HResult=-2146233088
Message=Exception of type 'OAuth2.Client.UnexpectedResponseException' was thrown.
Source=OAuth2
StackTrace:
at OAuth2.Infrastructure.RestClientExtensions.ExecuteAndVerify(IRestClient client, IRestRequest request)
at OAuth2.Client.OAuthClient.QueryRequestToken()
at OAuth2.Client.OAuthClient.GetLoginLinkUri(String state)
at NbcrsEvents.Social.Controllers.HomeController.Login(String providerName) in f:\Work\Projects\NbcrsV3\NbcrsEventsRepo\NbcrsEvents.Social\Controllers\HomeController.cs:line 51
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.b__41()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.End()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.b__33()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()
InnerException:

my controller code

public class HomeController : Controller
{
private readonly AuthorizationRoot authorizationRoot;

    private const string ProviderNameKey = "providerName";

    private string ProviderName
    {
        get { return (string)Session[ProviderNameKey]; }
        set { Session[ProviderNameKey] = value; }
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="HomeController"/> class.
    /// </summary>
    /// <param name="authorizationRoot">The authorization manager.</param>
    public HomeController(AuthorizationRoot authorizationRoot)
    {
        this.authorizationRoot = authorizationRoot;
    }

    /// <summary>
    /// Renders home page with login link.
    /// </summary>
    public ActionResult Index()
    {
        var model = authorizationRoot.Clients.Select(client => new LoginInfoModel
        {
            ProviderName = client.Name
        });
        return View(model);
    }

    /// <summary>
    /// Redirect to login url of selected provider.
    /// </summary>
    public RedirectResult Login(string providerName)
    {
        ProviderName = providerName;
        return new RedirectResult(GetClient().GetLoginLinkUri()); //I have exeption hire
    }

    /// <summary>
    /// Renders information received from authentication service.
    /// </summary>
    public ActionResult Auth()
    {
        return View(GetClient().GetUserInfo(Request.QueryString));
    }

    private IClient GetClient()
    {
        return authorizationRoot.Clients.First(c => c.Name == ProviderName);
    }
}

web.config


...

from oauth2.

semack avatar semack commented on September 26, 2024

Empty scope?
On Oct 7, 2013 10:07 AM, "SamZ" [email protected] wrote:

OAuth2.Client.UnexpectedResponseException was unhandled by user code
HResult=-2146233088
Message=Exception of type 'OAuth2.Client.UnexpectedResponseException' was
thrown.
Source=OAuth2
StackTrace:
at OAuth2.Infrastructure.RestClientExtensions.ExecuteAndVerify(IRestClient
client, IRestRequest request)
at OAuth2.Client.OAuthClient.QueryRequestToken()
at OAuth2.Client.OAuthClient.GetLoginLinkUri(String state)
at NbcrsEvents.Social.Controllers.HomeController.Login(String
providerName) in
f:\Work\Projects\NbcrsV3\NbcrsEventsRepo\NbcrsEvents.Social\Controllers\HomeController.cs:line
51
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase
controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary2 parameters)
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary2
parameters)
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.b__41()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass81.b__7(IAsyncResult
_)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.End()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult
asyncResult)
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.b__33()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()
InnerException:

my controller code

public class HomeController : Controller
{
private readonly AuthorizationRoot authorizationRoot;

private const string ProviderNameKey = "providerName";

private string ProviderName
{
    get { return (string)Session[ProviderNameKey]; }
    set { Session[ProviderNameKey] = value; }
}

/// <summary>
/// Initializes a new instance of the <see cref="HomeController"/> class.
/// </summary>
/// <param name="authorizationRoot">The authorization manager.</param>
public HomeController(AuthorizationRoot authorizationRoot)
{
    this.authorizationRoot = authorizationRoot;
}

/// <summary>
/// Renders home page with login link.
/// </summary>
public ActionResult Index()
{
    var model = authorizationRoot.Clients.Select(client => new LoginInfoModel
    {
        ProviderName = client.Name
    });
    return View(model);
}

/// <summary>
/// Redirect to login url of selected provider.
/// </summary>
public RedirectResult Login(string providerName)
{
    ProviderName = providerName;
    return new RedirectResult(GetClient().GetLoginLinkUri()); //I have exeption hire
}

/// <summary>
/// Renders information received from authentication service.
/// </summary>
public ActionResult Auth()
{
    return View(GetClient().GetUserInfo(Request.QueryString));
}

private IClient GetClient()
{
    return authorizationRoot.Clients.First(c => c.Name == ProviderName);
}

}

web.config

enabled="true"
clientId="_"
clientSecret="
_"
scope = ""
redirectUri="http://localhost:63482/Auth" />
...


Reply to this email directly or view it on GitHubhttps://github.com//issues/38#issuecomment-25788567
.

from oauth2.

samz-me avatar samz-me commented on September 26, 2024

or without it. The same error.

from oauth2.

semack avatar semack commented on September 26, 2024

Thank you for the stack trace, but could you show Response values?

from oauth2.

samz-me avatar samz-me commented on September 26, 2024

The problem was connected with invalid credential "Failed to validate oauth signature and token"
Sorry for inconveniences :)

from oauth2.

titarenko avatar titarenko commented on September 26, 2024

OK, thanks for good news :) It seems like we can close this issue.

from oauth2.

pankajray avatar pankajray commented on September 26, 2024

Please help:-

When login via fb I got exception at this point:
return new RedirectResult(GetClient().GetLoginLinkUri());..................Exception

Exception is:-

An exception of type 'System.MissingMethodException' occurred in eCommerce.dll but was not handled in user code

Additional information: Method not found: 'RestSharp.IRestRequest RestSharp.IRestRequest.AddObject(System.Object)'.

Thanks In advance

from oauth2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.