CORS issue when running ionic project on android and browser - ionic-framework

I am having an ionic 3 project which is accessing remote url. However when i run the project on browser with "ionic serve" or on android emulator/device using "ionic cordova build android" command I am getting this following error :
Fetch API cannot load API URL.
Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://localhost:8080' is therefore not allowed access.
I googled and found that this is CORS issue which occurs when one domain tries to access other domain, but the project works properly on other 2 machine on same network.
The database in use is couchDB.

You have to enable specific origins on the server that are allowed the access it.
The Ionic Team has also written a nice summary about CORS related to Ionic: Ionic Cors Documentation

First, check if your external API have SSL protection means it's Https instead of Http. And if it is Https and still you are getting the error then use below plugin instead of fetch() or Angular HttpClient.
https://ionicframework.com/docs/native/http

Related

Azure facebook login on localhost

For my cordova application i am running a Azure .net backend.
To access it from the client i use the mobile service client plugin for cordova.
Now to my problem:
I want to allow a facebook login which is already supported by the mobile service client. Therefore i registered a FB-application as described in the azure tutorial
Everything works well when i access the published backend. However if i am running it locally, the facebook login fails without any helpful error message.
It must be a problem with the facebook app settings.
For the case where i am running on localhost, i created a second testapplication with the following settings:
For the valid oAuth redirect URIs i have tried different things.
Does anyone have an idea how i could solve this?fa

Ember cli .39 not proxying API requests

Duplicate: Requests proxying stop working after update to ember-cli 0.39
This is known, fix is here and currently in master.
I just upgraded to ember-cli 0.39, and it seems my API requests aren't being proxied to my (rails) backend. This was working in 0.37.
I run the following commands from the respective directories
rails s -p 3900
ember s --port=4900 --proxy=http://0.0.0.0:3900
The ember app serves pages that don't hit my API, but when my routes try to fetch a model (I'm using ember-data), the API response is just my ember app's index.html. I've set some breakpoints in my rails code, and they're not getting triggered, so I know the API requests aren't being proxied appropriately.
Interestingly, I have a login route I use, and that does seem to proxy back to the rails app. But, whenever I use store.find('someModel'), the response is the ember app'sindex.html` and the app chokes.
As part of upgrading to .39 I changed some of my libs over to the ember-cli-addons:
ember-cli-ember-data
ember-cli-ember-simple-auth
I'm not sure if that has anything to do with it. Seems like it could be an ember-data thing.
This is known, fix is here and currently in master.

http status 302 error in tomcat eclipse

I am developing a Telco application (Dyanamic Web application project to send and receive sms) using Eclipse & tomcate version 7
When I try to run it on
http://localhost:8080/SMS1
It gives an error message HTTP-ERROR-CODE:302
What should I do to resolve this error
This is the link to Application and video tutorial what I am following
https://drive.google.com/file/d/0B3VmCeqDC7SDcFZaWVZhRUNmaTQ/edit?usp=sharing
HTTP code 302 is a standard "redirect" message--that is, it tells your web browser that the page was moved and where the new page can be found. I'm guessing whatever you're using as a web browser (Eclipse?) just doesn't handle that type of redirect. Try using a standard web browser like Chrome or Mozilla to see if that helps...
Also a guess, but the redirect may be trying to move you to HTTPS instead of HTTP, and your certificates may not be set up properly, or the port isn't enabled, or there may be some other problem with your HTTPS configuration. If the app is supposed to work over HTTPS, try going directly to the HTTPS version of the link to see if that's the real issue.
A third guess is the app may be trying to redirect you to a login page if you're not logged in, and maybe it can't find it. I'd need to know a lot more about the built product and I really don't want to mess with some guy's shared Eclipse project. Tell them to use a build tool!

Jenkins Github oAuth 404 error in callback

i am trying to use Jenkins' Github oAuth plugin (https://wiki.jenkins-ci.org/display/JENKINS/Github+OAuth+Plugin)
Name: Name of app
URL: http://server:8080
Cacllback: http://server:8080/securityRealm/finishLogin
When i enable Github oAuth, it did pop up to say whether I want to allow this Appliation from Github, then I click Allow.
So the authenticate step went through, but I hit 404 because The requested resource (/securityRealm/finishLogin) is not available.
There is nothing in Tomcat manager that says securityRealm, is there something else I need to set up to use this plugin?
If you do not have jenkins served at server:port then the callback will not be present. More than likely you are serving from server:port/jenkins because you are using tomcat and this is what is specified in the web.xml for the jenkins war.
The callback location for your server is going to be
server:port/jenkins/securityRealm/finishLogin
if you are using a Servlet container like tomcat or jetty.
Be sure to have the plugin correctly configured in your settings.
After entering the Client ID and Client Secret you get from github and restarting Jenkins it should work.
I ran into the same problem and this worked for me.
When I was in the process of setting up the OAUTH plugin, I found it handy to check the /var/lib/jenkins/config.xml file for correct settings:
<securityRealm class="org.jenkinsci.plugins.GithubSecurityRealm">
<githubWebUri>https://github.com</githubWebUri>
<githubApiUri>https://api.github.com</githubApiUri>
<clientID>3d404d2blah42ruSerious27</clientID>
<clientSecret>{AQAwZXfnxuJQxEL9iEEXuXPmW5BdeadBeefBreDactedJMcw==}</clientSecret>
<oauthScopes>read:org,user:email</oauthScopes>
</securityRealm>
It seems the issue is you need to have a Security Realm set beforehand for the route to be available. I did the following steps to get it working:
Install Github Oauth plugin (restarted Jenkins for good measure)
Go to Manage Jenkins -> Configure Global Security
Tick Enable Security and choose Github Authentication Plugin
Under "Authorization", make sure "Anyone can do anything" and click Save at the bottom. (Previously, I filled in all of the settings and hit save, however I was still receiving a 404 and locked myself out).
At this point, I tried to hit http://:8080/securityRealm/finishLogin and it responded with a HTTP/1.1 302 Found.
After I confirmed I was not receiving a 404 any longer for the resource, I went back into "Configure Global Security" and setup the rest of the plugin with the Client ID and Client Secret, selected "Github Commiter Authorization Strategy" for Authorization, added my username, saved and now able to auth via Github.
Hope this helps.
Jenkins Version: version 1.558
Github Auth plugin: version 0.14

JavaScript authentication with c# sdk. What happens on server?

I have made a JS authentication on local server, and it also went fluently on server side. As I understood the sdk cached up with the JS auth and all went well. But When I have uploaded this on server, the IsAuthorized method returned false after the JS auth. Why could that happend? And how does the sdk handle the JS auth?
Check your website url in the facebook app configuration page. Maybe the domain is now different?