Social login options in MobileFirst (Worklight) - social-networking

I need to implement social Login (facebook, Google, Twitter etc) in my hybrid application, which is being created using IBM MobileFirst Platform.
Which social login method is best for the mobilefirst hybrid application?
For Google login i am using hello.js with following code.
Is it possible to use the following code in MobileFirst??. The google will provide the response only through it's Redirect URIs. How can We get that response to MobileFirst hybrid application ??
hello.init({
google : GOOGLE_API_ID
},{scope: 'email' , redirect_uri:'redirect.html'});
hello.on('auth.login', function(auth){
// call user information, for the given network
hello( "google" ).api("me").then(function(json){
alert("Your email is "+ json.email);
}, function(e){
alert("Whoops! " + e.error.message );
});
});
Please suggest....

Your best approach would be to find good Cordova plugins that perform these login actions, as they would be the most suitable.
You will want to read about implementing Cordova plugins in MFP: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-6-3/adding-native-functionality/
And then try implementing various such plugins (google for them) until you find the right one for your app. If you encounter implementation difficulties, you should then open a new question with actual code we could help you with...
Facebook options to start with:
http://coenraets.org/blog/2014/04/facebook-phonegap-cordova-without-plugin/
https://github.com/Wizcorp/phonegap-facebook-plugin

Related

How to integrate my java application with Google Home?

I am trying to integrate my java app to google home.
Agenda : Taking the input from the google home as request and sending it to my application as a request parameter and giving back the response to the Google home. This is my agenda.
I am new to google home so if anyone knows how to do this please help me.
Thanks.
You want to look into the Actions on Google platform.
Actions run in the cloud, not on a device. Your Assistant device (such as a Google Home) acts like a browser.
There is a Java/Kotlin library available.

Is this really the process for authenticating users with the Google platform using Xamarin?

I am following the tutorial located here: https://developer.xamarin.com/guides/xamarin-forms/cloud-services/authentication/oauth/
I got to the step titled: Presenting the Sign-In User Interface.
It says that, "When the Login method is invoked, the sign-in user interface is presented to the user in a tab from the device's web browser."
Now is this really the process when using Xamarin?
Because the other apps I've downloaded and played with don't open the browser and then open a new tab to give me a choice of which account to choose. Those apps pop up a small page on top of the app and allows me to select an account.
If this Xamarin process is different I am not going to use it when developing my app. Please clear this up for me thanks.
There is no such thing as as "Xamarin's way of oAuth".
oAuth is about authenticating users through 3rd parties like Google, Facebook, Twitter etc. There are different oAuth flows which are mostly used: the implicit grant and the authorisation code grant. For mobile apps the implicit flow is common because auth code flow involves the app keeping a secret which a mobile cannot really guarantee. For a great overview of these flows I can recommend this lecture from Xamarin.University.
These flows are the same no matter which underlying development stack you are using.
The documentation you are referring to is using a library to help using these flows: Xamarin.Auth. As a matter of fact you don't have to use this library at all. This library helps with storing tokens, sending requests that include the required tokens, detect endpoint redirects etc. Part of using this library is presenting the UI where the 3rd party vendors login form is shown.
This is what you do when calling:
var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
presenter.Login(authenticator);
The actual implementation of presenting the UI is platform specific. On iOS the UI os shown modally if that's how you are coding it. If you change this code to show the UI as a small popup floating on top of existing content, you can of course do this. This is true for any given platform.

Using MSAL in a machine-to-machine scenario as a CSP

I am trying to use the GraphAPI using the official nuget library (https://github.com/microsoftgraph/msgraph-sdk-dotnet). However, the authentication process is not trivial and not very well documented.
I am in a CSP partner in a machine-to-machine scenario, so there is no UI application with a redirect url where a user manually enter it's credentials to consent access. But it seems to be the unique scenario well documented or available in the samples I found... Even the official CSP documentation is not clear (https://developer.microsoft.com/en-us/graph/docs/concepts/auth_cloudsolutionprovider).
I previously used many other APIs in production (and TIP environment) as a CSP like MSOL, CrestAPI and AzureGraph, so all the configuration and registration of the application is not a problem.
Is it possible to use MSAL as a CSP in a machine-to-machine scenario? Is there any documentation or sample available for my use case?
UPDATE
I think I am on the good path.
First, I had to register my app on apps.dev.microsoft.com. My apps were previously registered on portal.azure.com. Looks like AzureAD and Graph had different requirements related to where applications must be registered.
Second, I use the sample here: https://github.com/Azure-Samples/active-directory-dotnet-daemon-v2 .
Third, I am able to call the Graph API when I provide my CSP TenantId. However, when I try to call the Graph API using the TenantId of one of the tenant I manage, I got a:
{ "error": {
"code": "Authorization_IdentityNotFound",
"message": "The identity of the calling application could not be established.",
"innerError": {
"request-id": "7cab3137-b3e7-4622-9123-e47f2c018c56",
"date": "2017-09-04T14:48:34"
} } }
(I cannot have the consent page in my use case so I tried to pre-consent my app for all consumers using: https://developer.microsoft.com/en-us/graph/docs/concepts/auth_cloudsolutionprovider)
You can use MSAL to perform the auth required for the Graph SDK. There are some code snippets of using the .NET Graph SDK with the MSAL, but your best bet is the Connect Sample that shows this in a working app.
For a complete guided sample of how to use MSAL and what the library does, checkout the MSAL .NET Desktop Sample.

Google places api request denied error

I am using google palces api for autocomplete textview in my android project. I have enabled the api key. I am using a server key but all the time I have this error when I call the service through a browser :
{
"error_message" : "This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console: Learn more: https://code.google.com/apis/console",
"predictions" : [],
"status" : "REQUEST_DENIED"
}
And same error in android debugger.
As mentioned in the error, you have to go to the Google Developers Console, then open APIs & auth -> APIs and enable the Google Places API Web Service which include the autocomplete feature :
Find detailed information about places across a wide range of categories. Backed by the same database used by Google Maps and Google+, the Google Places API Web Service features about 100 million businesses and points of interest that are updated frequently through owner-verified listings and user-moderated contributions. Key features include autocomplete, search, place picker, photos and add place.
Hope that can help.

Gem to post message on google plus?

Is there any gem to post message on google plus from our rails application ?. I want to post a meesage on my google plus page whenever i logged in my application using google plus credentials. Please suggest me the gem name to do this. Thanks in advance.
EDIT
I have a app in goole plus. On behalf of my application users, my app should post messages.
I suggest to use gem 'google_plus'`
As Google plus having so many restrictions. Still I would Like to Share a link you can follow that..
How to share content from our site to google plus
For more reference:
https://developers.google.com/accounts/docs/OAuth2
https://developers.google.com/+/web/share/interactive#button_attr_calltoactionurl
I hope it will work fine...
Yes, there's a Ruby client library provided by Google which allows you consume their Google+ API
https://developers.google.com/api-client-library/ruby/apis/plus/v1
UPDATE
The URL above points to Ruby client library. The API you're looking for is moments.insert
https://developers.google.com/+/api/latest/moments/insert
There is an official Google API Client gem. However the Google+ API does not allow standard automated posting to a profile. The recommended approach to share posts is the share button or the interactive share API.
The automated posting that Google+ does support are:
App activities/moments are a way to make actions within your app visible to other users of your app. They do not appear in the Google+ posts stream.
Domains API can be used with Google Apps accounts to create posts that are limited to users within the company.
Pages API can be used to post to a page (not a profile) but is limited to approved partners.

Resources