Office 365 JavaScript API, redirect back to WP app after launching Store - api

I am creating a Windows Phone app using HTML And JavaScript. I am able to add connected services and have selected "Users and Groups" and given it Read permissions.
I am then making the following calls on button click:
var authContext = new O365Auth.Context();
authContext.getIdToken("https://TestDomain.onmicrosoft.com/TestWebApi").then(
function (token){
}
);
Services/Office365/Settings.js has been edited to the following:
Settings.clientId = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
Settings.authUri = "https://login.windows.net/common/";
Settings.redirectUri = "ms-app://s-1-15-2-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx/";
I got the redirectUri value by calling the following function:
Windows.Security.Authentication.Web.WebAuthenticationBroker.getCurrentApplicationCallbackUri();
I do get the login screen for my organization and I am able to provide credentials and it tries to redirect it back to my application, but then I get asked the following question:
"You need to install an app for this task. Would you like to search for one in the Store?"
If I click on yes, it takes me to the store and says "No apps found". If I click on no, it doesn't do anything.
How could I possibly get it redirected back to my app?

The connected services experience only works in Multi-device hybrid apps (a.k.a. Cordova), not in Windows Phone apps.

Related

React Native Linking Listener?

Description:
Built an app, need to implement Swedish BankID. This means, when user presses a button, the Swedish BankID App opens, and when the user has signed in, the Swedish BankID App sends the user back to my app (which it does automatically), in which I need to retrieve data (if sign in was successful or not).
What needs to be accomplished:
Open Swedish BankID on the device from my app. Need to be able to receive a payload from Swedish BankID App in my app (Swedish BankID sends user automatically back to my app).
Current Code:
const url = `https://app.bankid.com/?${autoStartToken}`;
const supported = await Linking.canOpenURL(url);
if (supported) {
const answer = await Linking.openURL(url);
} else {
Alert.alert(`Don't know how to open this URL: ${url}`);
}
Currently, the Swedish BankID App opens correctly, my question is, is there any way to receive data from the other app? I know this is possible with Native Modules (running Objective-C etc), however I am using Expo Client and do not wish to eject.
I have yet to find anything that suggests that React-Native can listen to the other app.
You can use expo WebBrowser to open url.
For authentication you will want to use WebBrowser.openAuthSessionAsync, and if you just want to open a webpage WebBrowser.openBrowserAsync
Exemple:
...
import * as WebBrowser from 'expo-web-browser';
....
const handleLinkAsync = async () => {
let result = await WebBrowser.openBrowserAsync('https://google.com');
console.log(result)
};
Since the BankID app can even be on another device (if you present the url as a QR code) it's kind of hard to communicate with the app. Also, from a privacy perspective the app isn't supposed to give a lot of information away.
What you can do is to "bounce" information via the app using the "redirect" parameter. That's especially useful when you want to tie back to the existing session. There are however a few caveats, especially when using multiple browsers, so make sure to read the Relying Party Gudelines.

Call app within another app and get a response from this app

I am developing an application for this new card machines that look like a smartphone, but inside my app I should call the card machine payment app and get a payment answer if it worked or not,
Would there be any way to do this to get the application response that was opened by my application?
I tried using Linking, but every time you open the app, it returns true, that is, it returns true because the app was opened, not the response that the app returns would be if the payment went well.
enter image description here
Thanks for the personal help but I did it, develop a module in react-native to call the application and get feedback by deepLinks thanks everyone follow her link
https://www.npmjs.com/package/react-native-deep-link-with-response

Confused with IOS Deep linking

I'll just want to ask if someone here know the step by step process of creating a deep link for an IOS app? I've tried to read some articles but it did not give me absolute answers. Thank you :)
Deep linking is basically just setting up url to your app so that other apps can launch it with information. The can launch to certain parts of the app if you set it up so that your app reacts to certain urls. So there are a few things that you have to do. For this example I will use two apps. If you are trying to integrate with an existing app you just have to find out what their url schemes are. So for this example I will use 'Messages' as one app and 'Schedule' as another.
First: in the 'Messages' app we will need to setup the schemes our Schedule app to call.
So open up your first app we need to add schemes so other apps can open it. Go to your info.plist click the little + and type URL types hit the triangle to expand and hit the + type URL Schemes and within that one add an item and put your apps name in it. Also add URL identifier along with $(PRODUCT_BUNDLE_IDENTIFIER) as the value. `
Then we just have to add the apps that we can open so hit the top level + again and add LSApplicationQueriesSchemes This whitlists the apps so we can evaluate weather or not they are installed on the device.
Now we can jump over to the other app and create a way to call this. For this example lets make it happen when we press a button.
IBAction launchMessagesApp() {
let url = NSURL(string: "Messages://") where UIApplication.sharedApplication().canOpenURL(url) {
self.launchAppWithURL(url, name: "Messages")
}
The canOpenURL(url) checks to see if the application is on the device. If you wanted to you could launch the app store to your app if that retuned false. then launchAppWithURL actually launches it. That is the basic setup you may also want to have multiple things happen so you may have multiple url schemes that launch the same app but take it to different parts of the app. In the app delegate of the app in the function
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
print(url)
//Any customizations for the app here
}
You can do anything you can imagine.
Have you checked out Turnpike? It's an open source tool for enabling deep linking in iOS apps. http://urxtech.github.io/#GettingStarted
If you want to create a deeplink you might need to do some server code to detect the user device/browser and do some actions based on this.
I've created a tool that simplify this process, you can check it here:
http://www.uppurl.com/
It's mainly a short link tool that checks for user device and give him the right url based on his devices. With this tool you don't need to write any server code and it also takes care of different devices, operating systems and browsers.

How to Sign-Out from an authenticated ListDataProvider/Authenticator in Windows Phone 8

I am reading a SharePoint list from Office 365 inside a Windows Phone 8 app. My app-code is based on this sample code from Microsoft. It uses
Microsoft.SharePoint.Phone.Application.ListDataProviderBase
Microsoft.SharePoint.Client.ClientContext
Microsoft.SharePoint.Client.Authenticator
The actual problem beeing signout not working!
On the first request to the server, the client asks for authentication and shows a hosted browser window where I can enter my account credentials. I select to stay logged in here.
If i restart the app, it authenticates me without showing the UI again.
I would like to be able to switch user or simply signout leaving no credentials on the phone behind.
I found the following static methods on Authenticator which do not change anything:
Authenticator.ClearAllCookies();
Authenticator.ClearAllCredentials();
Authenticator.ClearAllApplicationSettings();
What is the prefered way to do this?
This is an example of how I am logging out a user in my SP list App for WP8:
App.MainViewModel.IsInitialized = false;
Authenticator.ClearAllCredentials();
App.MainViewModel.Initialize();
MessageBox.Show("You have been successfully logged out, click refresh to login again.");
Your app maybe a little different, but you should at least get to the App and ViewModel to set Initialized as false. I did expxect the App.MainViewModel.Initialize() to show the login page but need to click refresh after calling this SignOut method to do so, that is why I displayed the messagebox.
Hope this helps you.

Implementing "Rate application" functionality on a Windows Store app

I am trying to implement rating functionality in a Windows Store application using HTML / Javascript.
I am showing a popup dialog similar to the one below within the application and when "Rate" is clicked I would like to redirect to the Marketplace where the user can then rate the application.
This is a task that can easily be done on Windows Phone 7 via the MarketplaceReviewTask.
Is there an API on Windows 8 that I could call to have this achieved?
The Rate and Review link in the Settings charm will automatically appear for users other than yourself (since you can't rate your own app).
If you want a custom link somewhere, you can use LaunchUriAsync like Jim says, using this URI:
"ms-windows-store:REVIEW?PFN=[my-pfm]"
where my-pfm is "Package Family Name" which you will find in your application manifest.
Here's a blog post I found that's helpful:
http://www.andybeaulieu.com/Default.aspx?tabid=67&EntryID=227
If you use protocol activation (LaunchUriAsync) with the URI format suggested here you'll get to your app's page on the Store; however, there's still an additional step for the user to click Write a Review. There may be a way to deep link to it and I'll update if I find out.