Comments (8)
Hi,
Could you please add more details on this exception? Maybe FieldName or Response property value? Thanks!
from oauth2.
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, IDictionary
2 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.WrappedAsyncResult
1.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.
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.
or without it. The same error.
from oauth2.
Thank you for the stack trace, but could you show Response values?
from oauth2.
The problem was connected with invalid credential "Failed to validate oauth signature and token"
Sorry for inconveniences :)
from oauth2.
OK, thanks for good news :) It seems like we can close this issue.
from oauth2.
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)
- yahoo always ask for permissions when user login
- Yahoo email retriever social API
- Library use old CommonServiceLocator version HOT 3
- documention HOT 1
- Instagram Problem HOT 7
- Can Support Amazon (Login in Amazon)? HOT 1
- Initialize Client from stored token HOT 1
- Example config for .net core HOT 10
- Using OAuth2 in winforms project HOT 1
- Update GitHub OAuth Client HOT 4
- Support for HOT 1
- Help Wanted - Twitter - I can't authenticate you HOT 1
- Exception of type 'OAuth2.Client.UnexpectedResponseException' was thrown. when retrieving User info from Linked In HOT 2
- Integration for Microsoft Azure Login APIs HOT 4
- VkClient return error HOT 5
- 谷歌登录有bug HOT 1
- New Refresh Tokens are not saved when using OAuth2Client.GetCurrentTokenAsync HOT 7
- Any plans to support RestSharp v107+? HOT 2
- What is the LICENSE for this library? HOT 1
- Unable to resolve 'OAuth2 (>= 0.10.3)' for 'net8.0-windows'. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oauth2.