I am trying to call the below URL from Google apps script. In my browser it works fine, but when run from Apps script I get the error 'Access denied'.
var response=UrlFetchApp.fetch(url);//Fails with Access denied exception
URL :
Gets stock data in JSON format
'Request failed for http://www.nseindia.com/live_market/dynaContent/live_watch/get_quote/ajaxGetQuoteJSON.jsp?symbol=AXISBANK&series=EQ returned code 403. Truncated server response: Access Denied Access Denied You don't have permission to access "http://www.ns... (use muteHttpExceptions option to examine full response)'
Do i need to do anything extra?
Status 403 indicates that everything went as planned, but the recipient denied the request. Without clarification from the host site, it's hard to say why it's rejecting the request, but it could be anything from the request being denied due to an issue with your code, or they may have a service in place that prevents these kinds of requests from unauthorized IPs.
They may even have blacklisted Google apps script specifically, due to the nature of the site you're connecting too, and the potential for abuse.
Related
CalendarApp.getDefaultCalendar() authorization
I have a similiar problem like the one below. As described in the answer, I started the jobs from script editor and granted the permissions. But I still get the error in my stackdriver error list and the action is not completed.
What can I do to authorize the script again or to get it running?
I am facing one problem while running the report in web url of ssrs, it is working fine with IE but not in chrome. Also some users access it fine and some users can't through IE. In call the cases we are getting below mentioned:
Error:
"Access is denied.
Description: An error occurred while accessing the resources required
to serve this request. You might not have permission to view the
requested resources.
Error message 401.3: You do not have permission to view this directory
or page using the credentials you supplied (access denied due to
access control lists). Ask the web server's administrative to give you
access"
Please help on the same.
Check following things in your report manager:
As per your error message Error message 401.3... (it says you don't have access, check if your account is added to security/permission list of report/folder)
Try:
Before opening the report directly, try to access the parent folder of the report (if you have access - to check report is not main reason of issue).
Check the data source configuration of report, are you able to test the connection (you should be getting like connection tested successfully if all set correctly)? If you have configured with Windows authentication, are the different servers in same domain?
I'm loading a cross-origin script that requires a username/password using HTTP Basic Access Authentication.
I'm not concerned with the security of the username/password. My code:
<script src="http://user:password#example.com/script.js"></script>
This works fine in most cases. However, if the credentials are incorrect, an authentication dialog pops up.
I would like to abort the loading of the script if the credentials are wrong instead of presenting the authentication dialog to the user. Ideally a JavaScript function would be triggered as well to alert that something has gone wrong.
Is this possible, and how would it be done?
I think this would fall on the server-side configuration.
Instead of sending a HTTP 401 Not Authorized with WWW-Authenticate header, the server should respond with a different status code, perhaps 403 Forbidden
The problem is that when a 401 is sent to the browser, the browser interprets that as a login requirement, prompting the user. If it receives another error status (i.e. 403) it will simply error out (which can be caught by a JavaScript function)
I am Getting Error 403 (You are not authorized to perform this request. That's all we know.) while retrieving all the files in the Google Drive using domain wide delegation. It is interesting as i am not getting the error for the first 12 times that i am acquiring the files but, after that i keep getting it.
If you'r getting Error 403 than there can be various reason like -
403: The authenticated user has not installed the app with client id {clientId}
403: The authenticated user has not granted the app {appId} access to the file {fileId}
403: Invalid accessLevel. This method requires at least {requiredAcl} level access to act on the file with ID {fileId}
403: The app with id {appId} does not exist or is not properly configured as a Google Drive app
403: App with id {appId} cannot be used within the authenticated user's domain
403: The app with id {appId} is blacklisted as a Google Drive app
According to Google Drive Developer. Please Check HERE for More Details. I hope you will be able to find out the cause of 403 Error.
I've been doing a lot of development locally with the Google Drive API, but suddenly I'm no longer able to access files using the downloadUrl link.
I'm wondering if I've been blocked or anything, although I can't see how as I should be well under the API limit. The 403 isn't the friendly Google one, but a standard:
HTTP Error 403 (Forbidden): The server refused to fulfill the request
Any ideas? Thanks!
Check the error messages on the 403 responses, it will give you some information. You may have to perform exponential backoff.
you are accessing google drive file using download url bt download url is expired after some time so that you catch error and generate new request for that file