c# - 'System.UriFormatException' for 'WebAuthenticationBroker.GetCurrentApplicationCallbackUri()' when authorizing SharpBox in Windows Phone 8 -
i want open web let user allow app access files. code here:
config = cloudstorage.getcloudconfigurationeasy(nsupportedcloudconfigurations.dropbox) dropboxconfiguration; requesttoken = dropboxstorageprovidertools.getdropboxrequesttoken(config, "xxxxxxxx", "yyyyyyyyy"); authorizationurl = dropboxstorageprovidertools.getdropboxauthorizationurl(config, requesttoken); uri requesturi = new uri(authorizationurl); debug.writeline("done requesturi"); uri callbackuri = webauthenticationbroker.getcurrentapplicationcallbackuri(); debug.writeline("done callbackuri"); webauthenticationresult result = await webauthenticationbroker.authenticateasync(webauthenticationoptions.none, requesturi, callbackuri); if (result.responsestatus == webauthenticationstatus.success) { icloudstorageaccesstoken accesstoken = dropboxstorageprovidertools.exchangedropboxrequesttokenintoaccesstoken(config, "7nu03leznnz6x74", "ex3gge8av7kp9lq", requesttoken); }
with these instances declared before constructor():
static dropboxrequesttoken requesttoken; static dropboxconfiguration config; string authorizationurl;
when run it, have exception a first chance exception of type 'system.uriformatexception' occurred in system.ni.dll
@ uri callbackuri = webauthenticationbroker.getcurrentapplicationcallbackuri();
line.
and if change uri callbackuri
string uri callbackuri = new uri("https://google.com");
it works fine todebug.writeline("done callbackuri");
new exception occurs:
an exception of type 'system.io.filenotfoundexception' occurred in mscorlib.ni.dll , wasn't handled before managed/native boundary
in line:
webauthenticationresult result = await webauthenticationbroker.authenticateasync(webauthenticationoptions.none, requesturi, callbackuri);
so did wrong? want make callback call app after opening web authorizing.
thank you.
Comments
Post a Comment