Which Google OAuth Flow is good for web application not reachable from the internet? - google-oauth

I wrote a small application which needs access to Google API with OAuth2 and which is typically run on maybe a Raspberry Pie to reduce power consumption since it needs to run pretty much 24/7. The device my application runs on is typically connected a LAN at home.
The user controls the application using a web interface from a PC/Tablet/... in the same network. However the web application is reachable from the LAN only, it cannot (and should not for security reasons) be accessed over the Internet, because it hides behind a NAT and/or a firewall.
The documentation states that I have the following options:
Web server applications
This forces me to use a redirect URL which must be known in advance. Since my app is most likely accessed by a dynamic private IP address, there is no way I know the URL in advance.
Installed applications
Yes, that would work. I just need people to copy and paste the returned code into a web form of mine. However that is somewhat uncool.
Client-side (JavaScript) applications
This does not give me a refresh token which I totally need.
Applications on limited-input devices
Polling? Well... If it works... However it requires the user to match a code shown on the device with a code displayed in the webbrowser. If I use that I can just as well ask the user to copy&paste the code returned by the installed app mode.
As far as I can see the copy&paste the code with installed app is my best chance. Is it really? Or is there is possibility to get along without that bit?

Related

How do I launch/publish my website? ASP.NET Core

I'm new to web development and just built my first website with .Net Core. It's primarily HTML, CSS, and JavaScript with a little C# for a contact form.
Without recommending any service providers (question will be taken down), how do I go about deploying the website? The more details the better as I have no idea what I'm doing haha.
Edit: I am definitely going to go with a service provider, however the business I am building the website for doesn't have a large budget so I want to find the best provider at the lowest cost.
Daniel,
As you suspect, this is a bit of a loaded question as there are so many approaches. One approach is to use App Services within Microsoft Azure. You can create a free trial Azure account to start that includes a 200.00 credit, which is more than enough to do all of this for free. Then, using the Azure Management Portal, create an App Service (also free) on an App Service Plan in a region that makes sense for you (i.e. US West). Once you do that, you can download what is called a Publish Profile from within the App Service's Management Portal in Azure.
If you're using Visual Studio, for example, you can then right click your project and "Publish" it (deploy to the cloud, or the App Service you just created). One option in that process is to import an Azure Publish Profile, which you can do with the one you just downloaded. This makes it really simple. The Publish Profile is really just connection information to your Azure App Service (open it in Notepad to see). It will chug for a bit and then publish and load the app for you. You can also get to the hosted version of your app by clicking the Url of the app in the App Service management portal on the main page.
This may be oversimplifying what you need to do, but this is a valid direction to take. AWS and others have similar approaches.
Again, tons of ways to do this, but this is a free approach. :-) I don't consider Azure a Service Provider in the sense that you asked us not to. Instead, I wanted to outline one turn-key approach with specific details on how to get there.
You can find specific steps in a lot of places, such as this link:
https://www.geeksforgeeks.org/deploying-your-web-app-using-azure-app-service/
DanielG's answer is useful, but you mentioned you don't want use any services from service provider.
Usually, there are only three ways to deploy the program,
first one is the app service provided by the service provider mentioned by DanielG,
**Benefits of using service provider products:**
1. Very friendly to newbies, follow the documentation to deploy the application in a few minutes.
2. It offers a very stable, scalable service that monitors the health of our website.
3. We can get their technical support.
**Shortcoming**
It is a paid service, and although Azure's service has a free quota, it will run out.
**Suggestion**
It is recommended that websites that are officially launched use the services of service providers.
second one is to use fixed IP for access (it seems that fixed iPv4 IP is not provided in network operations),
**Benefits of using fixed IP:**
If there is a fixed IP address, or if the carrier supports iPv6, we can deploy our website, and the public network can access it. And if you have domain, it also can support https.
**Shortcoming**
1. There are cybersecurity risks and are vulnerable to attack.
2. Without perfect website health monitoring, all problems need to be checked by yourself, and it is very troublesome to achieve elastic expansion.
**Suggestion**
It is generally not recommended because there is no fixed IP under normal circumstances. Broadband operators used to offer it, but now it doesn't.
If you are interested, you can try ipv6 to test.
the last one is to use tools such as ngrok or frp for intranet penetration.
**Benefits of using intranet penetration:**
Free intranet penetration services such as ngrok, the URL generated by each run is not fixed, and there are some limitations, such as a new URL will be generated after a certain period of time, which is enough for testing.
Of course you can purchase the service of this tool, which provides fixed URLs and supports https.
**Shortcoming (same as the second one)**
**Suggestion**
The functional implementation is the same as the second suggestion, and the physical devices used by the website are all their own. The intranet penetration tool (ngrok, or frp) solves the problem of not having a fixed IP, providing a URL that you can access.
There are few users and the demand for web services is not high, so it is recommended that individual users or small business users use ngrok and frp in this scenario. Generally suitable for OA use in small businesses.

Sonos Sample Server Authentication Error

I am currently in the beginnings of developing an integrated Sonos app, and to get a better understanding of what needs to happen, I downloaded Sonos's provided sample server for the "Acme" service.
On first use, I was able to get it working and was able to play songs from the static directory that was provided within the package. However, after closing the server, leaving my computer for some time, and booting it back up again with ./gradlew bootRun, I noticed that I was not able to use the sample service anymore. On the window to link the sample account, it said that there was an error in authenticating and that it might be an issue with the connection.
First things first, I rebooted everything I could reboot. Turned the gradle server on then off. Removed the service and created it again. I even did a factory reset and put the Sonos device (PLAY:1 variety) on a different network at the office. The sample service still won't authenticate.
What could be causing the authentication for the sample Acme service to stop working just like that on every network? I should mention that I have been using the same config settings ever since I got it to work the first time, so it should not be a problem with my configurations in the customSD page. Also, I have not changed any code within the sample server.
TL;DR: The Sonos sample server worked one time for me, and hasn't worked since on multiple networks and devices, even after a factory reset. What could be causing this issue?
It sounds like the player possibly can't find the sample server any more. When you set up the service via customsd, you used an ip address for the endpoint. Is it possible that ip address has changed?

Setting a remote authentication server on a router

I'm looking for a way to set an external authentication server that will work on many/most wireless routers. Or , alternatively several ways that will work on different wireless routers. It needs to be done programmatically, meaning, that a computer connected to the router needs to be able to use some api maybe to do this.
I don't know if this is possible, I tried to find answers on Google, but with limited knowledge, I'm not sure that I'm even looking in the right place.
What I'm trying to achieve:
I'm trying to create an application that will allow people to open there WIFI so other people can borrow it.
The ide is:
To borrowed wifis:
Create an account with the application.
Log into the application. This app will, when you are logged in, automatically connect you to a wifi nearby that is shared. The share wifi will only be accessible if you have a valid username-password combo with the application
To share your wifi:
From the same application, you go into some menu and press "share this wifi", and somehow, I need this to configure the currently connected router to use the an external authentication server as well as the current WIFI key. So that, people can essentially use their the application username-password combo to log into this router.
Any help is appreciated.
Try google-ing for Radius Server , WPA(2) Enterprise , or 802.1x.
These keywords are very related.
To setup a radius authentication you need to have a router which supports wpa(2) enterprise and a radius server (probably google-able how to setup on windows/linux).
Programmatically connecting is possible, only a bit more difficult because it uses wpa(2) enterprise authentication.
If you could supply some more details i should be able to help you further.

Share settings between related Windows Store Apps

We are currently planning to develop a suite of Windows Store Apps. They are independent and fully work alone, but they are related and act in concert. If a user has several of them, they should share some of their settings (and data), so that the user does not have to manually change these settings in every single one of them.
Is such a scenario even intented?
And how to implement it?
Registry: Does not work. Apps cannot access the registry.
ApplicationData (LocalFolder, LocalSettings etc.): Does not work. Apps cannot access the data of other apps.
Cloud services: Kind of works, but only when the machine is online. Our apps should work offline, too. And we would need to create/rent such a cloud service, which would cause additional costs.
KnownFolder.DocumentsLibrary: This –currently– looks like the only solution to me. The apps are already saving and sharing data there, so let's just save our settings there, too. But the name of the shared folder is one of the settings! And Windows Store Apps cannot create hidden files, so the user can see the settings file. This makes this solution a bit... "rough".
Any other ideas or additional information I have missed?
If you want them to sync with each other instantly, even when the device is offline, then that's your only option. Windows 8 Apps are not intended to share settings.
So much want of sharing.
Roaming API will only share with the SAME app, the SAME user, ANY W8 device.
SkyDrive will only share across ANY app, the SAME user, ANY device.
Using Azure (or any web service) will share across ANY app, ANY user, ANY device.
Don't do this
Don't use the register, the API is not supported
Don't use the file system, the boundaries cause your app to be brittle
Don't use ApplicationData.AnyFolder, this is restricted to a single app GUID
You had might as well get "instant" out of your language, man. That just doesn't happen. But you can have fast (let's call it near instant); you can use Sockets or SignalR to connect your client to some service out there with nearly instant responses. A less sophisticated approach would be to poll from your client, too. It has served developers for decades.

Is this possible for a Windows based machine to send and receive data to tailor made app on the iPhone?

I am making an app for the iPhone in Xcode which needs to be able to send and receive excel data from a windows based machine. Making the app is no trouble but what would I need from a PC to access the app data?
Firstly, I wouldn't be using Excel as a data storage program. What you really should be using is a database hosted on a web server with a PHP interface etc. If you choose to go the database route, then you can easily use a Windows machine.
Though if you choose to stick with Excel, it would be theoretically be possible given that people have made apps to have full control of a computer remotely via an app. I just think that this approach is going to be very hard to set up, and will be a lot more clunky than any sort of web server set up. Don't forget that you can get free web server services if the data level is low.
As you mentioned, this PC won't have access to the internet. Assuming you aren't willing to fix that, I guess you'd be left with a Bluetooth or local wifi option. Having to plug it in would really defeat the purpose of an app, and I don't think that iPhones can even do that without mad hacks.
An alternative idea is to build an app that links in with some free web server service, then build VBA code to download it to your Excel sheet. When you plug your iPhone into your PC, use the hotspot to get internet access.