How to add iframe of rocket chat in website - iframe

As i have read rocket chat documentation for i frame automatically login i follow these steps
Go to Adminstration > Accounts > Iframe and enable it.
Hit rest api and got userId and authToken .
But from where i got iframe code and how can i integrate it with application
Meteor.loginWithToken('3wzsXzG53AN5qU_byQVZZNt79oh5wviOMpwB2IHOyHR', callback);
I got this error :
Uncaught ReferenceError: Meteor is not defined
And where i used rocket server url . Please help me how can i login in rocket chat automatically when login in our application using iframe

Use IframeId with meteor call as below
document.getElementById(iframeId).Meteor.loginWithToken('3wzsXzG53AN5qU_byQVZZNt79oh5wviOMpwB2IHOyHR');

Related

Protecting route using firebase

I've provided code below in which a user can be redirected to dashboard page by successful authentication by firebase.But anyone can access dashboard page without authentication.Now how can I protect this dashboard page?
Note:I'm using HTML,CSS and JS as frontend and Node.js backend.
app.all('/login',(req,res)=>{
email=req.body.email;
password=req.body.password;
var prom=firebase.auth().signInWithEmailAndPassword(email,password);
prom.then((creds)=>{
res.redirect('/dashboard');
},(err)=>{
res.redirect('/error');
});
});
Expected output:
If anyone tries to access dashboard page without authentication then he must redirect to error page.

Angular 8 Firebase Login with Google failing with previously working project

I am working with a previously working Angular 8 project. The Auth module is not working as expected. When you click "login with google" the google account picker window pops up but then dissapears immediately.
Basically 403: Requests to this API identitytoolkit method google.cloud.identitytoolkit.v1.ProjectConfigService.GetProjectConfig are blocked
In the debug window I get the following error chunk:
{"error":{"code":403,"message":"Requests to this API identitytoolkit
method
google.cloud.identitytoolkit.v1.ProjectConfigService.GetProjectConfig
are blocked.","errors":[{"message":"Requests to this API
identitytoolkit method
google.cloud.identitytoolkit.v1.ProjectConfigService.GetProjectConfig
are
blocked.","domain":"global","reason":"forbidden"}],"status":"PERMISSION_DENIED"}
}
I have tried this on a couple of enviornements and it is still happening.
Make sure that your apiKey has access to the Identity Toolkit API. The security policy configuration may have been updated.
See Firebase auth internal error “SignUp are blocked” on web

javascript SDK suddenly stopped working without showing any error #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.

AngularJS + WebAPI External Google Authentication

I am currently setting up an external login (Google) into my AngularJS WebApp which is talking to a Web API, all locally, however I am having issues.
I have followed the steps in http://www.asp.net/web-api/overview/security/external-authentication-services on how to set up google authentication, which involves in just adding app.UseGoogleAuthentication(); without appId or clientSecret like other providers like Facebook.
Now going to my API I query and get all providers using following GET /api/Account/ExternalLogins?returnUrl=%2F&generateState=true , which return [{"Name":"Google","Url":"/api/Account/ExternalLogin?provider=Google&response_type=token&client_id=self&redirect_uri=http%3A%2F%2Flocalhost%3A11942%2F&state=E2eXxoZ02yUg39-DrwZTXHnrV5FrOhUe-k-zz-oD6uE1","State":"E2eXxoZ02yUg39-DrwZTXHnrV5FrOhUe-k-zz-oD6uE1"}]
and from reading in the internet I stripped the URL /api/Account/ExternalLogin?provider=Google&response_type=token&client_id=self&redirect_uri=http%3A%2F%2Flocalhost%3A11942%2F&state=E2eXxoZ02yUg39-DrwZTXHnrV5FrOhUe-k-zz-oD6uE1 and added into a anchor tag, so I suppose this should have redirected me to google authentication, however I receive a error message
Does anyone know why? Also when adding the link into an anchor tag I am adding the link for my API http://localhost:11942/ at the start.
Thank you
The method you are using to authenticate with google (Open ID) is deprecated, refer to:
http://blogs.msdn.com/b/webdev/archive/2014/07/02/changes-to-google-oauth-2-0-and-updates-in-google-middleware-for-3-0-0-rc-release.aspx
You need to use Google OAuth, try to follow the following article to configure Google authentication:
http://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on#goog

How to logout facebook connect user with Facebook Developer Toolkit?

How can I logout or disconnect a Facebook user in the Facebook connect session?
I'm using the Facebook developer toolkit. After using "connectSession.Logout()", the method "connectSession.IsConnected()" is still returning "true". Have I done something wrong?
EDIT: Now, I know that you can't logout a user just from the Facebook connect site. A user can be logged out only from the entire Facebook site. How can I do that with Facebook Developer Toolkit?
Edit:
In answer to your second question, just log them out using the JavaScript SDK:
FB.logout(function(response)
{
// user is logged out
// redirect to local logout script
});
Here's also an answer I made before that should help. This answer is for the older javascript and php SDK, but it should still apply.
How to log out users using Facebook Connect in PHP and Zend?

Resources