c# - Azure Mobile Services Custom LoginProvider redirect issues in Universal App with AuthenticationHandler -
c# - Azure Mobile Services Custom LoginProvider redirect issues in Universal App with AuthenticationHandler -
the problem:
mobileserviceclient.loginasync never exits login dialog - after access token gets returned.
the environment:
backend: windows azure mobile service .net/c# frontend: windows 8.1 universal store app. .net/c#the details:
in app, next code fails homecoming dialog brought on sec line:
var client = new mobileserviceclient("https://hana.azure-mobile.net", applicationkey); var result = await client.loginasync("smartthings"); speculation:
i suspect code in custom authenticationhandler handling challenge, blame. redirecturi in authenticationproperties override of applyresponsechallengeasync, null - sets redirect uri request uri.
the code looks following:
var redirecturi = request.frompath(options.callbackpath); var properties = challenge.properties; if (string.isnullorempty(properties.redirecturi)) { properties.redirecturi = request.uri.absoluteuri; } // oauth2 10.12 csrf generatecorrelationid(properties); var requesturl = formauthorizerequest(properties, redirecturi); response.redirect(requesturl); attempts @ resolution
use webauthenticationbroker instead of mobileserviceclient , expliticly provide callback uri. remove reassignment redirect uri. switch redirect , request uris. throw salt on shoulder. use test frontend on service navigate , test login. use httpclient , explicitly build request next parameter keys: "redirect_uri", "redirect_url", "redirecturl", "redirecturi". bleed goat change callbackpath value of authenticationoptions "/signin-smartthings". await ragnarokadditional details
i had create custom loginprovider , owin middleware register custom authenticationhandler owin pipeline. appears have been setup correctly, implementation of authenticationhandler may erroneous. gladly provide additional details on request if help expedite issue.
updates:
the response smartthings gives error "redirect_mismatch" in body when trying login webauthenticationbroker provided callback uri.
however, when navigating through browser, redirect uri gets processed "https://hana.azure-mobile.net/signin-smartthings?code=somemassivecode"
this confuses me bit because expecting see access token, rather auth token, redirect uri.
c# oauth-2.0 azure-mobile-services win-universal-app owin-middleware
Comments
Post a Comment