Google API Testing on non 'localhost' named local server - google-api

I'm currently running MAMP Pro (osX 10.9.4) with several different virtual servers on my local machine, one for each of my client's projects. I've been trying to connect to the Google API use OAuth and have everything working just fine when 'REDIRECT URIS' is set to:
http://localhost:8888
However, as mentioned I've got several of these servers running,
e.g. 'https://clientname1:8890' or 'https://clientname2:8890'
Whenever I enter those into the API console I just get a 'Whoops' message telling me something has gone wrong Google's end:
"Server Error: Whoops! Our bad."
It seems as though only 'localhost' is allowed via the API for local testing, is there anyway I can set it up so I can test off any of my local servers?

I had to add my localhost to the allowed referrers list to test locally. Without that inclusion, I get 403 Forbidden errors. You probably just need to add clientname1 and clientname2 or clientname1:8890 and clientname2:8890 to the allowed referrers list in the Google Developers Console. Mine's set under public api access, so maybe it's going to be another problem for you depending what API you're using and how you're using it. Hope it helps -

Related

Try to connect locally to Chatbot but get unauthorized error

I loaded the EchoBot template from Microsoft here: https://marketplace.visualstudio.com/items?itemName=BotBuilder.botbuilderv4
I started a new project and try to run it locally. No MicrosoftAppID or MicrosoftAppPassword is provided.
Then I loaded the latest Bot Framework Emulator v4.7
I connect locally, again no App ID or App Password:
However when I try to send a message I get unauthorized error, why would I get unauthorized error when connecting locally?
The server is definitely running locally and the local URL is correct:
One question I want to ask is the login dependent on any 3rd party URL call? My company security policy is blocking all URL unless whitelisted, so if this is the case, maybe the authentication is blocked? What would be the URL for me to whitelist?
EDIT: I tried it a VM outside of the company network and it works! So something must be getting blocked. Any idea?
I got around it by using a VM outside the company network instead. It's not a solution, but it is a work around. I highly suspect some port are being blocked by company firewall but not sure what so I am not sure how to get it whitelisted.

Web API: Insufficient Privileges on Private Projects

Configuration Details
We have a SonarQube 6.7.2 (build 37468) on-premise installation running.
The instance is accessible from our office IP without HTTP Basic Auth, as well as from everywhere else with HTTP Basic Auth.
The "Force user authentication" option is off.
All projects are set to private - in case someone gets past the HTTP Basic Auth.
My user belongs to the sonar-administrators groups and has "Browse" and "See Source Code" permissions on all projects.
Using the web interface in the browser, I am able to see all projects including analysis results etc., as expected.
Problem
However, using the Web API, I receive "Insufficient Privileges" errors on several API calls.
My user has a valid token that I pass to cURL as described in the documentation. I even created a new token, to be sure I'm not using an invalid one.
Example
$ curl -X GET -u my_user_token: https://sonar.example.org/api/measures/search_history?component=the_project&metrics=lines_to_cover%2Cuncovered_lines%2Ccoverage&ps=1000
{"errors":[{"msg":"Insufficient privileges"}]}
Question
Is it not possible to retrieve measures information or project information via the API for projects that are set to private?
The above call works fine if the project is to public. (But then again, if the project is set to public, that call works fine even without authentication.)
We do have the same issue when using the SonarLint plugin for PHPStorm. The plugin works fine as long as the projects are public, but server sync stops working as soon as projects are set to private.
I'm thinking maybe it would be best to deny all requests to SonarQube except from our whitelisted office IP and have everyone connect via VPN if they want to access the instance from their home office. That would allow us to make all projects public and not have any of these issues. Is that the recommended way to run an on-premise installation of SonarQube?
Turns out the SonarQube instance was running behind an nginx reverse proxy that dropped the Authorization HTTP header from the request before passing it on to SonarQube.
After fixing the nginx configuration, all Web API calls work as expected.

How can I hit a local dev server from UI generated by apiary command line tool

I am using apiary preview --server to watch a file while editing it and have a UI generated.
I would like to hit a local dev server in the "Try" section of the UI, but when I hit "Call Resource", a request is made to POST https://jsapi.apiary.io/apis/null/http-transactions/.
HOST is set to http://localhost:3050 and I'm expecting it to hit that endpoint.
How can I change this?
$ apiary version
0.5.2
Currently, all console calls are routed via apiary.io servers to work around CORS limitations.
If published, you can work around this limitation by exposing your local port using service such as ngrok.
There is a testing of a version of the console that would make calls to the API directly and would utilise browser plugin if needed to get around CORS limitations. You should be able to utilise them soon.

API call within a Web API fails

I am working on a web api backend.
I am trying to make a call to another web api from within one of our api controllers.
When I run this as a unit test it works fine.
However, when it is hosted on IIS Express the GetAsync call fails with the exception: "No connection could be made because the target machine actively refused it 127.0.0.1:8888".
When we host it on azure we also get a similar exception.
Is there a setting in our web.config missing?
Any suggestions?
looks like it is still pointing to local host, needs to point to IIS or Azure server.
Check for hardcoded values in test code or web config.

Web API on IIS7.5 Unable to download * from localhost

I'm currently trying to install web api project directly from vs 2013 to my local dev machine, but when I test one of my http get controllers, I get the following:
My url looks like this:
http://localhost:8081/api/Location/States?queryTerm=Ark
When I test this on my local, this url works and I get my json response.
pay no attention to the web config error in the background. If I enter anything invalid, I get an IIS error, so I know I'm hitting the right URL.
Side note: I'm using IE8 for testing.
I found out the solution, and it may be a config thing, but when I made this as an virtual application to a website, this went away, and it gave me a yellow sign of death (which is a good thing). I was able to deduce this to be an oracle issue, where it couldn't find the database connection, and then found out it couldn't resolve tns names.
So I guess Web API can not be hosted by itself on IIS? I haven't looked into it, but it seems this to be the case, unless there needs to be more tweaking involved.
i know too late for response. But i get same error when I try deploy Odata v4 Application in IIS server.
In server , i hit this error as above, i try everything config but nothing change.
At last, i try connect from client and it work.
I recognize that in Client , it download a json file from Server (in case use Odata , it seem like wsdl file in webservice) and API still work well.
For some reason, it cant download in server, but dont worry, it still work.
Hope this helps!

Resources