Silverlight out of browser in SharePoint webpart - silverlight

I have an issue with my Silverlight webpart in a SharePoint 2010 site. The Silverlight app works great in the site and even out of browser. The issue I'm having is how to autoupdate the out of browser app. I currently have this:
if (Application.Current.IsRunningOutOfBrowser)
{
App.Current.CheckAndDownloadUpdateCompleted += new CheckAndDownloadUpdateCompletedEventHandler(Current_CheckAndDownloadUpdateCompleted);
App.Current.CheckAndDownloadUpdateAsync();
}
void Current_CheckAndDownloadUpdateCompleted(object sender, CheckAndDownloadUpdateCompletedEventArgs e)
{
if (e.Error == null && e.UpdateAvailable)
{
MessageBox.Show("Application updated, please restart to apply changes.");
}
if (e.Error != null)
{
MessageBox.Show(e.Error.Message);
}
}
but it doesn't run when it's SharePoint. I have to currently send out an email to all of my users thay may be using this app out of browser and have them uninstall and install it again. Does this have something to do with how SharePoint uses security? When a user double clicks on the desktop icon to open the oob app, it does give a credential login. My guess is that's what's throwing off the auto update.
Thanks!

The fix was to sign the xap files and place this code after authentication takes place!

Related

Teams Tab for dynamic SharePoint page / authentication problem

Heyo,
I am trying to build a multi tenant Teams App with personal tabs. The goal is: the user is authenticated (silently like explained in the Microsoft example, a static html page with the JavaScript code is hosted in an Azure Storage), then my custom web service is called and answers with a SharePoint-Online URL which contains an SPFX Webpart. Then the user is redirected to that page. When the user is not registered he gets an error page instead. The problem here is, that I am not able to redirect the user to that SharePoint page. The SharePoint page won't open in the iframe of the Teams tab because the tab's domain is the domain where my static web page is hosted. So my first question is how can I achieve this? (I do not know the SharePoint URL at build time, i do not know if the user has a page at all. This is determined in the custom web service at runtime)
A different approach would be to build a custom JavaScript application (in react, like my SPFX webpart), host it on my static web page and communicate with the SharePoint from there. To test my idea I added permissions for SharePoint in my Azure AD application, wrote a simple call to the SharePoint with the obtained token.
var req = new XMLHttpRequest();
req.open("GET", "https://[tenant].sharepoint.com/sites/[sitecollection]/_api/web/lists", false);
req.setRequestHeader("Authorization", "Bearer " + idToken);
req.setRequestHeader("Accept", "application/json;odata=verbose");
req.onreadystatechange = function () {
if (req.readyState == 4 && req.status == 200) {
var result = JSON.parse(req.responseText);
}
};
req.send();
The problem is my SharePoint is answering with 401 and "Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown" error in the response.
Is this some sort of CORS problem or do I need a different type of token for SharePoint? Or do I have to use a complete different JavaScript library to authenticate vs SharePoint.

Owin OpenIdConnect Active Directory HttpContext.GetOwinContext doesn't open microsoftonlin login page

I'm trying to use Owin and OpenIdConnect to authenticate users via active directory (office 365 online). I've followed this example and I managed to create a new MVC test project and get it all working. (Settings for AD app id, tenant, Web config etc all fine).
I'm now trying to add that functionality into my existing ASP.net mvc application and I can't get the dang thing to work.
This is what I have: An Account Controller with a "void" action like this (from the example that works in my PoC but not in my actual application):
public void SignIn()
{
// Send an OpenID Connect sign-in request.
if (!Request.IsAuthenticated)
{
HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/" }, OpenIdConnectAuthenticationDefaults.AuthenticationType);
}
}
When this action is invoked, I expect the browser to be directed to: login.microsoftonline.com..., but instead it opens this page: https://localhost:44301/Account/Login?ReturnUrl=%2fAccount%2fSignIn
It's like it's calling some sort of redirect somewhere and I can't see where.
Help!
I found the answer. I had to do 2 things:
Remove the WebMatrix dll's from the references (apparently nuget package for mvc put it there, so it might come back)
Remove authentication mode="Forms" from web.config
Thanks.

google+ login codenameone not working in devices

the google login works in simulator but the app crashes in all devices i checked.
sign.addActionListener((e) -> {
String clientId = "704790222159-n1cpb3g1q3plirslu5739apc0gnnv4pp.apps.googleusercontent.com";
String redirectURI = "https://www.youtube.com/";
String clientSecret = "q_cxGCCbX5GVC99kxgstjksB";
gc = GoogleConnect.getInstance();
gc.setClientId(clientId);
gc.setRedirectURI(redirectURI);
gc.setClientSecret(clientSecret);
gc.setScope("https://www.googleapis.com/auth/youtube.force-ssl");
gc.setCallback(new LoginCallback() {
#Override
public void loginFailed(String errorMessage) {
Dialog.show("Error Logging In", "There was an error logging in: " + errorMessage, "OK", null);
}
#Override
public void loginSuccessful() {
Dialog.show("Logged In", "you are currently logged in ", "OK", null);
}
});
if (!gc.isUserLoggedIn()) {
gc.doLogin();
} else {
token = gc.getAccessToken().getToken();
}
});
In simulator following login page appears and it works fine but in real devices the login page(allow/deny page) doesnt appear after i sign in ,and then app crashes after a while
error log:
error log
verbose log:
device error log
I debugged a similar problem yesterday. It's because the app isn't being given proper permissions. If you manually grant the permissions on your device (under settings->apps->your app) the login with Google will work fine (at least with Android, iOS I still can't get to work, it just spins endlessly).
It's build mysteries like this that aren't explained in any documentation that prevent me from getting invested in codename one, unfortunately. It seems to have so much potential but I'm constantly up against the wall with issues just like this that reduce my productivity.
The simulator uses all of these hints which work for the web login fallback. The device uses native login which is defined thru a combination of build hints and website configurations.
I suggest reading this section of the developer guide.
I would also suggest connecting a cable to an Android device and using the Android SDKs DDMS tool to debug crashes of this type.

Angular MVC Web API 2 Deploy to remote IIS issue

I have an application that uses MVC 5, Web API 2, and Angular and I'm having some trouble getting it to work properly. I am using the default MVC routing to initially load the shared layout page, and I'm then using the angular routing to essentially have a single page application. The error I'm getting is the identity impersonate error. (below)
HTTP Error 500.24 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
Most likely causes:
system.web/identity#impersonate is set to true.
I have set the identity impersonate to false, still did not work. I also added the line below to the config file, still did not work.
<validation validateIntegratedModeConfiguration="false" />
Here is my Application Start method:
protected void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
Here is my route config
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
There is a second part to my question that may be related to the issues I'm facing. I have the application under the default web site in a subfolder (I navigate to server.com/appName). I can get to the home page, but clicking on any links presents the error mentioned above.
Any ideas? Let me know if more code is needed.
I have the application under the default web site in a subfolder (I navigate to server.com/appName).
You need to run ASP.NET (or MVC) inside of an IIS application for it to function. It won't function correctly from a subdirectory of an application.
In Internet Information Services Manager, navigate to the virtual directory, right click it and choose "Add Application". Enter a name, application pool, and the physical path, then click on "OK".

iOS app stacks on login when permission removed through web interface

I have an issue with iOS6 which is app can't re-authenticate after its permission was removed through web interface
Its state stays "On" in iOS preferences, which does not reflect current state of OAuth
Which leads to limbo when app tries to authenticate but gets an OAuth error
Also seems like there is no way to manually remove permission from builtin facebook preferences
Did anyone face similar issues? Any possible workarounds?
If the Facebook access token in the iOS cache is out of sync with Facebook, you can force a sync of the credentials:
// Only do this if there is native Facebook Account support (iOS 6+)
BOOL isFacebookAccountsAvailable = (&ACAccountTypeIdentifierFacebook != NULL);
if (isFacebookAccountsAvailable) {
ACAccountStore *accountStore = [ACAccountStore new];
ACAccountType *accountTypeFB = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSArray *fbAccounts = [accountStore accountsWithAccountType:accountTypeFB];
for (ACAccount *fbAccount in fbAccounts)
[accountStore renewCredentialsForAccount:fbAccount completion:^(ACAccountCredentialRenewResult renewResult, NSError *error) {
DLog(#"Renew account error: %#", error.localizedDescription)
}];
}
I'm having pretty much the same issue. I tried to remove my app from my applications list on the Facebook website. Now when I log out and log back in, I get the same invalid token. I've got to go to the settings on my iPhone and disable facebook access for my app. This resets the token.
The SDK provides a method
[FBSession.activeSession closeAndClearTokenInformation];
but it does not solve this issue.
It seems like the case is being handled correctly with latest update of Facebook SDK

Resources