Google-plus sign in With AngularJs - javascript

I am trying to implement google+ signin using https://github.com/sirkitree/angular-directive.g-signin , it is very simple to implement as explained in this module but i am not getting it worked.
below is the js fiddle for the src.
jsfiddle
<div ng-app="directive.g+signin">
<g+signin clientid="620125449078"></g+signin>
<p>This is a Google Plus sign-in button</p>
</div>

You have to use Google's API console to create YOUR OWN client ID which pairs with the domain serving the login button.
Please read the documentation here.

Related

URL is not displaying in google plus share button, showing link is invalid

I have created a Google Plus share button for my portal user (internal user) where portal user can share the content of the portal using the Google Plus share button but unfortunately while passing the content link from the {url} its not registering the url and in preview popup window. It is showing 'link is not valid'. The link which I wanted to share is something like below:
https://example.force.com/portal/apex/homepage?id=kJ054000000CbSXXXX&l=en_US
I encoded it before passing it in the url tag. The link is basically will redirect to a customer login page and after successful login user will able to see the content.
<a href="https://plus.google.com/share?url=https%3A%2F%2Fexample.force.com%2Fportal%2Fapex%2Fhomepage%3Fid%3DkJ054000000CbSXXXX%26l%3Den_US" onclick="javascript:window.open(this.href, '', 'menubar=no,
toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;" >
<img src="img.png" alt="Google+"/></a>
I had also faced a similar problem in using google plus share URL. It is also mentioned in the google plus share documentation HERE https://developers.google.com/+/web/share/ that You must properly escape any user-generated content that may occur within {URL}. But when I tested it on live server it just worked! So what I found that it will not work on local server but it will on live! you can also test it on live. My functionality is running perfect now!

Working around same origin policy

I want to make an iframe in which i load a web page that i have on other server and i would like to fill some inputs via jquery, i know i cant do this since both apps are on different servers and have different ips, but i tried the next thing.
I made an URL rewrite on my IIS so my Host app matches 192.168.25.17 and made an url for the child app match the next ip 192.168.25.17/mysecondapp so i tried to run a jquery and it failed, so i checked the document.domain and both says its 192.168.25.17 what am doing wrong? or how can i check what is troubling me for working around the policy?
<button class="btn btn-success" id="botondeMagia">Set UserName</button>
<div id="magicContainer">
<iframe id="foo" src="http://192.168.25.17/apex/anapp.faces" height="500px">
</iframe>
</div>
<script>
$("#botondeMagia").on('click', function() {
$("#magicContainer input").val("TEST!!");
$("#magicContainer input").text("TEST!!");
});</script>
I don't know if the next info is useful but, the second app doesnt have jquery, just the hosting app.
The guest app is hosted in tomcat
Thank you very much
Actually Quentin is right, i had to use
$("#magicContainer").contents()
for viewing the contents on it, URL rewrite actually is great workaround for this tho
thank you so much guys

Linkedin share plugin not submitting form

I am using LinkedIn share button on my site with the following html:
<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-url="www.aidh.co.uk/blog/1506-exposure/default.html"></script>
The button brings up the Linkedin plug in with all of the content correct and options for sharing.
https://www.linkedin.com/cws/share?url=www.aidh.co.uk%2Fblog%2F1506-exposure%2Fdefault.html&original_referer=http%3A%2F%2Fwww.aidh.co.uk%2Fblog%2F1506-exposure%2Fdefault.html&token=&isFramed=false&lang=en_US&_ts=1432834994124.3257
However the share button on Linkedin's own page doesn't submit the information to Linkedin.
Can anyone help?
Take a look here: Official Microsoft LinkedIn Share API Documentation. It seems like the only valid format is something in the following form...
https://www.linkedin.com/sharing/share-offsite/?url={url}
For example...
https://www.linkedin.com/sharing/share-offsite/?url=http%3A%2F%2Frevoltlib.com%2F
This means that you only have the url param to modify.
If you are interested in a regularly maintained github project that keeps track of this so you don't have to, check it out! Social Share URLs
Read the documentation of LinkedIn plugin.
(https://developer.linkedin.com/docs/share-on-linkedin)

Google Drive API, can't open standard sharing dialog via JS (x-frame-options error)

I have a JavaScript app which uses the Google Drive API. I read how to open a standard sharing dialog here: https://developers.google.com/drive/web/manage-sharing
<head>
...
<script type="text/javascript" src="https://apis.google.com/js/api.js"></script>
<script type="text/javascript">
init = function() {
s = new gapi.drive.share.ShareClient('<MY_APP_ID>');
s.setItemIds(["<MY_FILE_ID>"]);
}
window.onload = function() {
gapi.load('drive-share', init);
}
</script>
</head>
<body>
<button onclick="s.showSettingsDialog()">Share</button>
</body>
Seems like I do everything right, when I click my share button, the dialog starts loading but it can't be loaded.
In the console I see:
Refused to display 'https://drive.google.com/share?...' in a frame
because it set 'X-Frame-Options' to 'SAMEORIGIN'.
I've googled this error and I've seen that there are some similar questions in SO and other sites, but they don't help. I guess Google doesn't allow itself to be in a frame in a not-google-site (cause of "SAMEORIGIN").
What can I do to open sharing dialog in my app?
The "Launching the Google Drive sharing dialog in your app" page here states:
The URL of the page that launches the dialog must have the same origin
as the Open URL registered for the app.
If you then look at the instructions to "Configure the Drive SDK" here, you can see that the "Open URL" section reads:
There are two important things to keep in mind for the Open URL:
Make sure you give a fully qualified domain name for Open URL -- localhost won't work.
The URL must belong to you. After the app registration is complete, you'll need to verify your ownership of this URL in order to create a
Chrome Web Store listing. For more information, see Site Verification.
Hence your page which is launching the dialog does not have the same origin as the Open URL registered for the app in you Google Drive SDK settings. So to fix your problem correct the Open URL so that it has the correct URL i.e. a URL with the same origin as the Open URL. Note that you can change the Google Drive SDK settings via https://console.developers.google.com/project.
As well as making sure the Open URL is set correctly. You'll also need to substitute your Drive SDK app ID for 'MY_APP_ID'. You can find the App ID by following these instructions:
Goto https://console.developers.google.com
Click your project
Click "APIs and auth" on the left
Click the "Drive SDK" settings cog icon
The "App ID" can then be found under the "Google Drive SDK" title e.g. App ID: 47XXXXXXXX3
The problem was solved thanks to this answer https://stackoverflow.com/a/20742994/1185123
dan-man says in his answer:
Client ID You can find this in the Google Cloud Console - see above.
Mine is a 12 digit number, so yours will probably be too.
Mine client id looks like
175564412906-ui22fsaghkvkkj09j2bprku55m8k3d0d.apps.googleusercontent.com
I've used this id in
s = new gapi.drive.share.ShareClient('<MY_APP_ID>');
After reading the answer, I tried to use only first 12 digits of my client id. I didn't expect it to work, I was just desperate. But the strange thing, it works perfectly!
If somebody can explain why it works and why nothing about this is said in the documentation — you are welcome to answer!

facebook comments - doesn't let me moderate

I'm trying to install facebook comments on my page, but it doesn't let me moderate. On a test page with only the comments plugin - no problem. the same code exactly on a live page - doesn't let me moderate.
the test page:
http://www.radicalislam.org/test3.html
the live page:
http://www.radicalislam.org/news/pakistan-hands-huge-prison-sentence-bin-laden-informant
tried to debug, it shows the right admin and app id.
it's a drupal site, if it's important
Looks like you are using partial URLs for the href. Use the full one.
Use the following instead.
<div class="fb-comments" href="http://www.radicalislam.org/news/pakistan-hands-huge-prison-sentence-bin-laden-informant" data-num-posts="5" data-width="580"></div>
Unfortunately my work Firewall wouldn't let me click through to the link.
Are you using the correct URL when you add the Facebook comments to the page? If you aren't you won't be able to moderate, you will likely need to dynamically add the URL to the generated code.
Have you tried scraping the page using the debug tool (as the admin)?
http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.radicalislam.org%2Ftest3.html
This will read the updated admin IDs and let the administrator see the moderation panel in the plugin and via https://developers.facebook.com/tools/comments

Categories