How to remove sign-in restriction from Google Form programmatically? - authentication

I am creating Google Forms programmatically with a Google Script project.
DriveApp is used to grant view access to anyone with a link.
var form = FormApp.create("Test form");
var formFile = DriveApp.getFileById(form.getId());
formFile.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
However the Form still requires "anyone" to sign-in and it's restricted to my G Suite domain users. I've tried to find how to disable this but I don't know how the feature is even called in Google Scripts.
See the attached image with a checked box:
Note: I can disable the sign-in requirement manually. But Forms are delivered to respondents automatically and there's no time to do this manual step.

I haven't had to do this, so I'm not sure if it's what you need, but have you tried using the setRequireLogin(requireLogin) method when creating your forms?
See https://developers.google.com/apps-script/reference/forms/form#setRequireLogin(Boolean)

Related

Auto login to website using script or bookmark

I've been trying to figure this out using various different methods. I'm trying to create a script/bookmark or some type of quick action to open a browser tab or window with a specific URL, and automatically log me in using my credentials. I'm not all that concerned about security for this at the moment.
At first I figured I'd try to use a javascript bookmark to do this, but nothing I found in my research worked. Next I tried to create a bash script, but I couldn't figure out how to send the credentials in via the terminal. Most recently, I literally copied the source code of a site, created a local file and tried to hack together something where I could prefill the form data with credentials and use JS to submit the form, and I've gotten close with this, but for some reason when I use the JS submit function, it errors out and says that the username and password are invalid. But when i turn off the submit function and manually click "log in" on my local html page, it works as expected. I want this to be a one click process, so the idea of using onload/submit or something to that affect is really important to me.
The site I'm testing with has a Rails backend and my next attempt might be trying to use POST to do what I'm thinking, but that's currently outside of my level of knowledge on the subject.
Anyone answering: i do not want to use a password manager to accomplish this.
My requirement is that i will either be able to a) run a script or b) use a 1-click option to do this per website. Ideally i'd be able to set this up in a sort of programmatic way to do this with multiple sites, but I'd be happy with 1 at the moment.
i know similar questions have been answered before, but I haven't been able to use information from those posts (the ones I've seen anyway) to figure out a good way to do this.
Create a bookmark for the current page you have opened.
Edit the bookmark
Change the value for the URL to something like this.
(javascript:(function(){CODE_GOES_HERE_FROM_BELLOW})();
find the field for username and password on the page.
Given example for hotmail
var inputs = document.getElementsByTagName('input'); for(var i=0;i<inputs.length;i++){if(inputs[i].name === 'passwd'){inputs[i].value = 'YOUR_PASSWORD'}else if(inputs[i].name === 'loginfmt'){inputs[i].value = 'YOUR_USERNAME'}}; document.getElementById(document.getElementsByTagName('form')[0].id).submit();
OR
try out casperjs.
The proposed solution didn't work for me and rather than spending tons of time installing a testing framework that I'll never use other than for this purpose, I decided to try to do this another way.
First, I found out that the reason my JS wasn't working before is because the site did not allow a JS submit to be done, or atleast that's what it seemed to be when I got this error: "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience"
The javascript I was using was in fact working, just not submitting. I used the following code to fill the fields (using "Class Name" elements on the page since there was no name or ID):
document.getElementsByClassName('username')[0].setAttribute('value', 'user');
document.getElementsByClassName('password')[0].setAttribute('value', 'password');
As I mentioned, the problem was when I tried to use JQuery to submit the form: document.getElementsByClassName('loginForm')[0].submit();
Which is when the above error cropped up. I can't really say for sure whether this is the root of the cause, but the page does submit, but I get an invalid username/password error when I do
I haven't figured out a great way to get around this just yet, but my short-term, "hacky" solution was to use Applescript to send a return keystroke to the browser to submit the form. I'd ideally like to figure out how to get the submission to work using JQuery, but I'm not sure how to get around it.

Is it possible to exclude links from tracking

I am building an app which is utilizing Sendgrid Marketing Email API, with the purpose of sending newsletters. It has a number of links to articles, but also banner ads and other service links. We would obviously like to keep tracking of article links, but exclude other links from affecting the click rate. Is it possible in any way to mark links which we don't wish to add to tracking?
Minor thread necromancy to let anyone who gets here via google know that they added an attribute to disable link tracking.
https://sendgrid.com/docs/Classroom/Track/Clicks/click_tracking_html_best_practices.html
Click tracking can be turned off for individual links by including the clicktracking=off attribute inside the anchor of an HTML link before the href. For example, <a clicktracking=off href="http://example.com">link text</a> would not be tracked.
The current click tracking application for SendGrid overwrites all links and there isn't, at this time, a way to customise this so only certain links are tracked.
One alternative would be to turn off the Click Tracking app in your SendGrid dashboard, but switch on the Google Analytics app (under Apps > Show Disabled Apps > Google Analytics).
With this app switched on, you can then build out custom links that you want to track using the Google Analytics URL Builder.
This would stop SendGrid rewriting all the URLs, and allow you to specify URLs that you want to track. However it would mean you will lose click event data in your SendGrid analytics, and via the Event Webhook, but the important data that you want to track for your campaigns would still be stored in Google Analytics.
You can also disable Sendgrid's tracking using the api. To do this you set some email headers.
Example X-SMTPAPI header value:
{
"filters" : {
"clicktrack" : {
"settings" : {
"enable" : 0,
"enable_text" : false
}
}
}
}
This works for plain text emails.
See: https://sendgrid.com/docs/for-developers/sending-email/smtp-filters/#filter-clicktrack
1.To disable tracking for a specific link add clicktracking=off before href
eg: <a clicktracking=off href="http://destination-domain.com">text</a>
2.To disable sendgrid link tracking for all mails
Goto Settings -> Tracking -> Click Tracking -> turn off link tracking

Showing file selection UI : Integrating Dropbox with OAuth 2

I am trying to create a web page which will allow my user to upload a file to my S3 storage. For choosing the file user can use Google Drive, Dropbox and also local system. Am facing issues while implementing the Dropbox part of this.
Am using this technique for integration(using core API and OAuth 2).
First when user chooses Dropbox i am opening an HTML page in an IFrame. Here I have an authorize button which will open the authorize endpoint mentioned in the above link. This link shows me X-FRAME-Options error inside the Iframe so i had to open this link as a popup to work.
Is there a way around this? I'd like the authorize URL to open in the same iframe by using location.href.
Also when i open it as a popup, after the user logs in successfully the redirect_uri which i pass i getting opened in the popup. I had to do some unconventional setInterval coding to go around this. Can someone suggest a solution for this as well?
I also tried using CSRF tokens as mentioned in Smarx's blog but this also gives me the same error.
EDIT :
#smarx i tried using dropbox.js and it works fine. Stuck at one place
I used the OAuth popup driver and have a button which says sign-in.
First on load i create the client and then the popup driver as below
client = new Dropbox.Client({ key: client_id });
client.authDriver(new Dropbox.AuthDriver.Popup({
receiverUrl: "http://localhost/uploadCare/dbcallback.html"
});
);
And in the call back html i am writing
Dropbox.AuthDriver.Popup.oauthReceiver()
as mentioned in the docs.
But this does not take me back to the original page and show me the list of files.
I particularly did not understand this part of the explanation
"To use the popup driver, create a page on your site that contains the receiver code, change the code to reflect the location of dropbox.js on your site, and point the Dropbox.AuthDriver.Popup constructor to it."
Could you please help me out here.
You definitely can't put dropbox.com into an iframe, for security reasons (e.g. clickjacking).
A few suggestions:
Can you just use the Chooser for your use case? That would certainly be easier for you and your users.
If you can't use the Chooser, is there a reason you're not using dropbox.js? It has a popup auth driver that will pretty much just take care of all this for you. The redirect will definitely happen in the same window as auth, so communication between the windows (usually via localStorage) is generally necessary. This is already done in dropbox.js.

Login to Google from iFrame

I have seen that it is not possible to display any Google page from an iframe. An error message is displayed: cannot display, open in a new window.
I need to login to Google (OpenId authentication) from an iFrame in Joomla (cannot change this). Is there a workaround for this? I thought I could open the authentication page in a new window, and then try to kill that window and reload the original one, but I am not sure I can do that.
Thanks
Well you can just get the form (html code) and put it in your iframe but this will get very messy, for example, there maybe certain JS files that you need to include as well.
Redirecting to Google is best way to implement it.As Using IFrame Sometime does not allowed by some Companies Due to Security.

SharePoint 2010 move bcs profile page

Is it possible to move the SharePoint 2010 BCS profile page, normally located under:
https://***.orbitone.com:443/__bdc/https___***_orbitone_com/Projects_1.aspx?JOB_ID={0}
To:
https://***.orbitone.com:443/Projects_1.aspx?JOB_ID={0}
Thanks!
It is a work around I guess but works well. I have tried it out.
1.) Create the profile page in the desired location (Web Part page)
2.) Export the web parts(2 web parts) from original profile page and add it to you custom page.
3.) Connect the web parts and test the page whether it is working properly like the OOTB profile page.
4.) Create a new action in the External Content Type and give the above new URL in the below format
https://???.orbitone.com:443/Projects_1.aspx?JOB_ID={0}
5.) Select the other parameters appropriately. Don't forget to give parameter as the identifier(JOB ID). Make sure you select this action as default action.
That's it :)
It should work in the way you expect. Let me know if you face any issues.