How to add password to website using Ngrok - ngrok

I'm using ngrok to expose my website to Internet, and I have a question is it possible using ngrok to add password to website, so before someone see the website has to enter password ?

You can use basic ngrok authentication using bellow command to start exposing your server
ngrok http {port_which_you_want_to_expose} -auth="{username}:
{password}"

I used
ngrok http 8000 --basic-auth 'ngrok:issecure' --basic-auth="username:password"
You need the issecure flag, and also the --basic-auth= should be wrote like this not like -auth= only

Related

Rest api returns error 403 while calling from Wordpress but works in postman

I have one server on which Apache and Tomcat both are installed to run my Wordpress and Java application respectively. Both are on same ip address and using same domain https://www.example.com only port number is different.
Wordpress is running on default port while Tomcat is runing on 8443.
A rest api on Tomcat https://www.example.com:8443/myApi.html is working fine from postman, but when calling from wordpress using ajax, it returns error 403 forbidden response.
I am stuck on searching its solution but failed.
Please help me out to solve this issue.
Thanks
You cannot use a different port, even when using the same domain. This breaks the Same origin policy.You can however use JSONP if you have access to both the daemon and the requesting site. If data needs to be returned, then the daemon needs to support a callback query parameter and return it properly formatted.
please see 1) https://stackoverflow.com/a/2099771
https://stackoverflow.com/a/2099784

Ngrok not working correctly

I've installed ngrok in Win 10 on a VM but I don't think it's working correctly.
To start it up and I use this command below to run it
ngrok http -host-header="localhost:44368" 44368
and it looks like ngrok starts up ok, but when I put the https url given by ngrok into a browser this is what I see
Shouldn't I see something?
and in the ngrok console I see the get requests but no response times or response messages
same with the localhost:4040 page and every get request has a 0ms response time
I had the same issue running an ASP.NET Core MVC Server.
Upon lots of investigation, disabling the https url of my server seemed to work.
So essentially forcing it to only use http.
I had the problem using both http and https ngrok urls.
So for my ASP.NET core project in the launchSettings.json, ensure you only have the http option, remove the https url under your desired launch profile:
"applicationUrl": "http://localhost:5001;"
If it is still not works for you after #MikeDub's fix, please try this.
Go to properties of your startup project (api project) and untick,
Enable SSL
in Debug section.
As MikeDub mentioned above, I also found the exact explanation on Twilio documentation here:
https://www.twilio.com/docs/sms/quickstart/csharp-dotnet-core#allow-twilio-to-talk-to-your-aspnet-core-application-with-ngrok
which indicates removing https App Url.

how to test Onesignal push notifications on localhost?

I want to test OneSignal push notifications on localhost before I deploy my app to a remote server.
I followed the instructions provided by the documentation. When I enter http://localhost as the site url I get an error message that says:
localhost is already taken. Please enter a different name.
Is there a way to use OneSignal on localhost ?
It should be https://localhost not http://localhost. OneSignal treats localhost as secure connections.
Besides configuring OneSignal via dashboard, your OneSignal.init in your browser call must have the allowLocalhostAsSecureOrigin option:
OneSignal.init({
allowLocalhostAsSecureOrigin: true,
...
})
More at https://documentation.onesignal.com/docs/web-push-setup-faq#section-how-do-i-test-my-site-on-a-local-environment
read in this doc https://documentation.onesignal.com/docs/web-push-setup-faq#section-how-do-i-test-my-site-on-a-local-environment- and localhost must run in port 8000
You may use Postman.
Just follow this steps, found at: One Signal documentation
Select POST and use url https://onesignal.com/api/v1/notifications
Set headers, like this:
And, finally, add the push body
Surprisingly, simple. Enjoy.
For anyone else struggling with this, the answer is to add 'http://localhost' but when the configurator comes back with a message similar to 'localhost is already taken. Please enter a different name.' jut scroll down and type in a different subdomain. It's not very intuitive but that worked for me.
In order to test onesignal push notifications over localhost, you should enable https://localhost on your test environment.
The following great post help me to setup it on macos, but I think you could implement it in other operative systems:
https://medium.com/#jonsamp/how-to-set-up-https-on-localhost-for-macos-b597bcf935ee
When you are able to start your web server at https://localhost:8080 , you should configure on OneSignal App the following:
Site Url : https://localhost:8080
Check "My site not fully HTTPS"
CHOOSE A LABEL : your-test-env.OS.TC
By completing the setup suggested by Onesignal documentation, you will be able to test push notifications on your test environment.

localhost tesing oAuth - Yahoo, MSN, Hotmail, Facebook

I know that there are many questions like this, but most seem to be older.
I know all about setting up my web app on the above services, and have seen that most require a valid domain for a callback [www.abc.com/oauthReturn.aspx].
What do I need to do in order to test locally, where the return URL would be: http://localhost:0000/oauthReturn.aspx ?
You can't use http://127.0.0.1 in Yahoo - not a valid URL.
I'm running asp.net/VB.net, IIS7. Localhost runs Windows 7 & Prod server runs Windows 2008 server.
When I try accessing the microsoft site, I get an error message, after I sign in, about not allowing localhost.
Any help is appreciated.
Thanx
Jerry
Try following the instructions here. Make sure to read all the way to the bottom where they suggest registering the localhost call back URL in bit.ly (or some other URL shortener) and using the bit.ly link as the call back URL.

Not able to use windows live api on local

HI,
I have issue in using Windows live API
Iam using asp.net, am not able to use the callback url on local
The signin link is working only if i provide live url, but i cant able to use local host.
Please help
It may help someone else also -
Please add following entry in hosts file (located at [%system drive%]\Windows\System32\drivers\etc)
127.0.0.1 www.example.com
#[Please replace example domain with your actual one]
Windows live server expects your return url to have http:// in it but chrome does not add it and IE do add it, I realized this after wasting sometime.
This should get you through testing api on your local machine.
Go and setup a dynamic dns and a name for your computer and make your tests this way.
For example you can setup on DynDns.com a name for your dynamic ip, and then setup your router with that name to automatic assign it (or do it manual from the pages), and then you can use this name, and not the localhost. Do not forget to open the port to your router so the other side can make requests.
Also on /windows/system32/drivers/etc/host you can also setup the same name to see your local host and make your tests and callbacks.
Your problem is that the callback address needs to be the same as the address you used to sign up with.
(In relation to your callback), from the documentation:
The domain name portion of the URL (for example, www.contoso.com) must
be the same as the one that you specified when you created your
application with Live Connect. The URL must use URL escape codes, such
as %20 for spaces, %3A for colons, and %2F for forward slashes.
So, based on what you have said, you are using localhost (which you can't). As #Aristos suggested, add an entry to /windows/system32/drivers/etc/host to the domain you have registered (eg www.contoso.com).
Use www.contoso.com instead of localhost to test.

Resources