javascript SDK suddenly stopped working without showing any error #linkedin - linkedin

I have create an app to achieve login-with-linked-in functionality. Previously it worked fine, but all of a sudden it stopped working.
Previously if user already logged-in to LinkedIn, clicking the login-in-with-linkedIn button will lead user to there corresponding dashboard, otherwise login-popup open and user details get saved in db and user redirects to corresponding dashboard,But now nothing happening.
Note:- I have used my custom button to use this functionality. not the linked-in provided button code.
Here is my code and app creation steps:-
Button code:-
<?php echo Labels::getLabel('LBL_Linkedin',$siteLangId);?>
Javascript sdk code:-
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key:*********
authorize:true
</script>
<script>
function doLinkedInLoginForBuyer(){
IN.User.authorize(function(){
onLinkedInAuth();
});
}
function onLinkedInAuth() {
IN.API.Profile("me").fields("email-address","first-name","id").result(function (data) {
processLinkedInUserDetails(data);
}).error(function (data) {
$.systemMessage('There was some problem in authenticating your account with LinkedIn,Please try with different login option','alert alert--danger');
});
}
processLinkedInUserDetails = function(data){
data = data.values[0];
fcom.ajax(fcom.makeUrl('LinkedIn', 'loginLinkedIn'), data, function(t) {
var response = JSON.parse(t);
if(response.status ==0){
$.systemMessage(response.msg,'alert alert--danger');
}
if(response.status ==1){
location.href = response.msg;
}
});
};
</script>
Note:- It seems that onLinkedInAuth() as well as processLinkedInUserDetails() functions are not called at all now. Previously they worked fine.
Let me know if any other details are required. Thanks!

After a long discussion with LinkedIn Customer Support they just said that they didn't support API-related issues. They asked to buy a premium account for any kind of technical support
Also I come to know that they stopped giving support for Javascript SDK.
Check here:- JavaScript SDK is not currently supported
Solution:- Now I followed the below post and make it work:
https://www.codexworld.com/login-with-linkedin-using-php/
Visit LinkedIn Developers page and log in with your LinkedIn account credentials.
Click the Create app button to create a new LinkedIn app.
Provide the information about your app and click Create an app to submit the app registration form.
App name – Name of the application.
Company – Name of your company.
App description – Workflow of the application.
App logo – Logo to display on the OAuth dialog.
Privacy policy URL – URL of the Privacy Policy page.
Business email – Your email address.
Products – Select the products that you’d like to add to your app.
On successful app creation, the page will be redirected to the App settings screen.
Switch to the Auth tab » Scroll down to OAuth 2.0 settings section.
Specify the redirect URL in the Redirect URLs fields and Update the App settings.
Note: The Redirect URLs must be matched with the Redirect URL that is specified in the script.
In the Application credentials section, you will see the Client ID and Client Secret of your LinkedIn App. The App ID and App secret need to be specified in the script at the time of the LinkedIn API call.
Now you have to create PHP code that will call linked-in API with the help of Client ID and Client Secret.
Kindly check Php code of thread for example.

Related

How can I open a teams popup webview with a Teams messaging extension?

I am currently trying to implement an oauth flow within a Teams Messaging Extension. I use ASP.NET and I managed to make the sign in process work, by using the sign in card recommended by Teams.
ComposeExtension = new MessagingExtensionResult
{
Type = "auth",
SuggestedActions = new MessagingExtensionSuggestedAction
{
Actions = new List<CardAction>
{
new CardAction
{
Type = ActionTypes.OpenUrl,
Value = authUrl,
Title = "OAuth"
}
}
}
}
This card has a button that opens a specific popup window (a Teams webview) which I can relocate to the oauth authentication page of a third party site.
All this goes very well, but when the user tries to log out, in my case it is not enough to just revert the tokens I got from the server, I also need to navigate the user to the third party site's /forcelogout subpage in the exact same webview which I used in the sign in process, to make sure the cookies related to the previous login session are getting deleted. By this I can prevent the login form getting auto filled and submitted when the user tries to sign in the next time they use my Messaging Extension.
My problem is that I can not find any way to open that exact webview from the Messaging Extension (this problem only occurs on the Teams Desktop Client, since the web version of Teams uses browser tabs instead of webviews and iframes). I tried using Task Modules, the dialog module, adaptive cards but none of them could open that specific webview that has the cookies for the login form.
Do you have any solution for this?
Authentication provider could receive an optional parameter to always prompt the auth-form by neglecting the cookies.
Using this way there is no need to open any webview when the user logs out.

Firebase SendEmailVerification in Xamarin : how to handle this in App?

I am trying to use email verification in my Xamarin/Firebase app.
I currently have:
using (var actionCode = ActionCodeSettings.NewBuilder()
.SetHandleCodeInApp(true).Build()) {
await user.SendEmailVerification(actionCode);
}
This properly sends a verification email.
What I don't know is how to specify a callback in the app to catch user clicking on the verification link.
Any advice/guidance will be appreciated.
It's still unclear to me what's the point of the SetHandleCodeInnApp option. It seems to indicate that there is a way of handling the verification event in the app
Whether the email action link will be opened in a mobile app or a web link first. The default is false. When set to true, the action code link will be be sent as a Universal Link or Android App Link and will be opened by the app if installed. In the false case, the code will be sent to the web widget first and then on continue will redirect to the app if installed.
For more details, you could check the document. https://firebase.google.com/docs/auth/android/passing-state-in-email-actions

How to embed Google Login button for authentication on web using firebase

I am planning to use google firebase for handling my website authentication but I cannot find any documentation on how to embed the google sign in button on my page. I don't plan to embed the default platform.js script as it is not being used to handle authentication.
All functionality is being handled by firebase. Also, I plan to use a custom UI and not the Firebase UI for the web.
The button text should also be customisable for different signup and sign-in button modes.
are you using angularfire for Firebase, if you're not using it's ok, try to go through this link firebase Google Sign In Method.
Firebase Google Sign in works like, it creates a new user if the user does not exist in the firebase Authentication if the user exists it will not the create user. So you don't need to worry about the sign in and sign up. Just provide it with Google Sign In. For Example, consider this scenario. If I am a new user to the Google Sign In, it will ask me to Sign In into the Gmail account, Once I am Logged it will never ask me to log in again unless I Log out, if I logged out the next time when in press Google Sign In, it will automatically log me in.
If your looking for code with button Login, please code it like below,
<input type="button" onclick=callGoogleSignIn() value="Google Sign In"/>
<script>
function callGoogleSignIn(){
var provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
// ...
});
}
</script>
Please feel free ask any doubts if you have and go through this site For Firebase Google Log in. This site has developed the google log in with firebase, see how they used it. Hope this helps.
### firebase based phone authentication ###
### firebase and code setup ###
download this repository https://github.com/Varadsingh/google-phone-auth/archive/master.zip
go to https://console.firebase.google.com/project/
create a new project
go to the setting button and then click on "Project settings"
now in the "Your apps" section select the "Config" radio button
copy the code given
paste the code in /firebase/init.js change the variable name as required
now back to firebase console, in the "Develop" section click on "Authentication", then go to "Sign-in method", here in "Sign-in providers" section, click on "Phone" section and enable it
you can also add a dummy phone number and verification code for testing purpose
in the "Authorized domains" section, add your domain for example "localhost"
### points to be noted ###
the code runs properly on a server environment, meaning it won't run by just double-clicking on the html file
you need to copy the code to the root/htdocs/public_html folder on the server that you use example XAMPP
firebase authentication requires captcha verification, and in the code, the verification has been kept invisible, therefore it might take a few moments to initialize

Checking ASP.NET Membership Authentication from Browser Extensions using JavaScript

Checking ASP.NET Membership Authentication from Browser Extensions using JavaScript
Hi,
I have a website [Visual Studio 2012 website] that uses ASP.NET Membership with OAuth/OpenID. Now I need to create a browser extension [Using Crossrider.com APIs for Chrome, IE, Safari etc.] which will enable logged in [to my website] users to bookmark a URL from the browser extension on button click and save the URL to a database in my website using JavaScript. The website then can show the bookmarked URL for the logged in user in some DataGrid.
Now my questions are:
1. What's the best approach to do this?
2. How do you check if a user is authenticated or not from the browser extension using JavaScript?
3. How to save the bookmarked URL to the Database in my website for that logged in user?
If I understand you correctly, you want the event handler of extension button to send the URL of the active page to your website. In general, you can achieve this by capturing the URL of the active tab using appAPI.tabs.onTabSelectionChanged and then using appAPI.request.get (or post) to send the data to your website database.
Regarding the user credentials, assuming you are authenticating the user in the extension, you can save the credentials to the local database using appAPI.db.set (get to retrieve the data) and send it as part of the request to save the URL. The following code shows the principle idea:
In the background.js file, implement the button handler and saving the URL to your site:
appAPI.ready(function() {
var activeUrl = null;
// Keep track of the active tab's URL
appAPI.tabs/onTabSelectionChanged(function(tabInfo) {
activeUrl = tabInfo.tabUrl;
});
// Configure the extension's button
appAPI.browserAction.setResourceIcon('icon.png');
appAPI.browserAction.click(function() {
// Send bookmark to your website
appAPI.request.post({
url: <YOUR_WEBSITE_URL>,
postData: {
bookmark: activeUrl,
token: appAPI.db.get('userToken'); // User Credentials
}
});
});
});
In the extension.js file, save user credentials to the extension's database:
appAPI.ready(function($) {
// Your authentication code
...
userToken = ...;
// Save the credentials
appAPI.db.set('userToken', userToken)
});
If you require further assistance and feel that stackoverflow is not the appropriate forum to discuss the specifics, please email our support team (support#crossrider.com).
Disclaimer: I am a Crossrider employee

Facebook PHP SDK - Logged in/Not Logged in/Connected to App Status

I currently have a Javascript that enables me to identify the three states of the user visiting my site:-
Not logged in to Facebook
Logged in to Facebook but not connected to my app
Logged in to Facebook and connected to my app
This is great and works wonderfully, except that I have three different bits of content to be displayed for the three types of status and currently we load all three states into the DOM and use jQuery to display the correct version as soon as the status of the user is understood.
Loading three different content types only to ever display one is not a very good way of doing things. I have two options:-
Use the Facebook SDK to get the same information server side
Use AJAX to load the correct content
So, my question: Is it possible to determine the three states that I've listed above using the Facebook PHP SDK?
FB.getLoginStatus(function(response) {
if (response.authResponse) {
FB.api('/me', {accessToken: response.authResponse.accessToken}, function(user) {
//connected to the app
});
} else {
if (response.status == "not_authorized") {
// logged in but not connected
} else {
// not connected to Facebook
}
}
});
Any help on this much appreciated because I'm a bit stumped after many hours of trying.
Take a look at the session variables.
I seem to remember that if the user is logged in but hasn't authorized your app that the access token will be your app's access token instead of a user access token.
Also take a look at the example from Facebook's PHP SDK on how to use it along with the JS SDK making sure you have cookie:true set for the JS SDK.

Resources