Is it possible to use custom domains without owner verification with appengine? - google-app-engine

I have an application hosted by Google Appengine and I need to serve it using custom domain. Is it possible to use custom domains without owner verification?

In order for a custom domain to serve your GAE app, Google must verify that you are indeed an owner of the domain (DNS entries often need to be added, etc.)

If you DNS provider can do a 301/302 HTTP redirect, you can set it up to redirect to your app's underlying app_id.appspot.com URL, but the user would be seeing it after the first page load in the browser address bar.
Without validation though, you won't be able to host a site directly.

Related

App Engine access service(s) with custom domain and HTTPS

I have a GAE app set up to use a custom domain, let's call it mycustomdomain. This naked domain is working fine over HTTP and HTTPS. I also have a service called api, it can be accessed successfully by going to http://api.mycustomdomain.com (custom domain convention).
However, I can't access the api service over HTTPS. I uploaded a SSL for mycustomdomain.com, but I got an error (site can't be reached) for trying to accessing the api service over HTTPS. My question is do I need to purchase the wildcard.mycustomdomain.com SSL in order to access the api service over HTTPS? I don't have much experience dealing with SSL certs and GAE custom domain, so any help would be greatly appreciated. Thank you!
Edit: updated information for GCP Console configurations.
My app setup in the Console contains the following:
Services: default, api
Custom domain setup: mycustomdomain.com
SSL uploaded: ultrahdlivewallpaper.com (NOT the wildcard version), api.ultrahdlivewallpaper.com (unable to be enabled for custom domain, none matching)
More detail: The problem is when I map both ultrahdlivewallpapers.com and api.ultrahdlivewallpapers.com, they are both mapped to the default service. I want api. to point to the API service. If I only map ultrahdlivewallpapers.com, that allows me to access api service at the api subdomain, but then the api SSL can't be applied to api. subdomain because it's not listed as a subdomain.
07/24/17 Update: I believe this is a limitation with the App Engine Settings after trying out several scenarios via GAE Console. We have a custom domain set up for ultrahdlivewallpapers.com and enabled the SSL cert for this domain. The domain is pointing to the default service. We have a second service set up called API. Google's routing rules for any service set up is via HTTP:// service-id.custom-domain, which in our case is api.ultrahdlivewallpapers.com. However, when I upload the SSL for the api subdomain, Console couldn't find matching domains because the api subdomain is not specified via the Console. Now if I set up api.ultrahdlivewallpapers.com as a custom domain, I'm able to enable the SSL for api subdomain. Problem then becomes api subdomain is now pointing to the default service instead of the api service. If I remove the api mapping, I'm able to browse to the api service again, but no HTTPS! I don't believe there is a way to get this set up correctly without a wildcard SSL enabled for all subdomains. Please let me know if I'm missing anything. I have tried everything I can think of via the Console. Thanks.
You don't necessarily need a "wildcard" cert, per se. But, you do need to get a cert that covers all the subdomains. For example:
mycustomdomain.com
www.mycustomdomain.com
api.mycustomdomain.com
It's a standard solution, and not difficult to do. Certbot (Let's Encrypt) makes it easy.
If you choose to get a wildcard certificate installation is pretty straight forward:
You upload the certificate in the developer console (in App Engine -> Settings -> SSL Certificates -> Upload a new certificate). May require a bit of effort, see also Google App Engine SSL with Let's Encrypt "could not be inserted".
Once it's visible in the certificate table you can click on its name and you'll end up in the certificate edit screen where you can select which custom (sub)domains it applies to (from the list of all custom domains mapped in the app), looks like this:
Note: these are the corresponding custom domain mappings:
If you have another app (under the same admin account) which is also mapped to subdomains of the same domain you can activate the certificate on it as well in a similar manner (the console automatically shows the certificate in the list when you switch apps, no need to upload it again).

How to handle social logins on subdomains loaded as domains via CNAME?

I have a project where subdomains are created for each of my users. So, if my project is example.com, a customer of mine might have steve.example.com.
I then added social logins with Google and Facebook. For Google's "Authorized JavaScript origins" and "Authorized redirect URIs", they don't allow wildcard domains. What's the best way to handle this?
Next, it gets more complicated for users that want to load steve.example.com on their own domain via CNAME. So if example2.com's DNS is pointed to steve.example.com, it appears I need to add example2.com to my Authorized Javascript Origins. What's the best way to handle this? Can I add it via API? I can't find any documentation regarding this and I'd rather not have to manually add 1000 subdomains and domains to Google.
Do you want a user to authorize a scope "A" for site 1 and get it auto approved for site 2? Most likely not.
If you use the same client ID (put these all in the same project) that means they should just be approved once by a user. This may be a privacy violation if the sites are different and a user may not want to sign-in to one of those but into another.
To solve this, you should be creating a different client id for each of your customer.
Another good reason to create a project/client id is if for some reason there is abuse and one of the client ID is compromised then other/all customers are not effected.
If you are creating project/client ids for each project then you should add the right subdomain there during the configuration. I also recommend not having all the projects (1000s as you say) in one Google account.

appengine access via oauth2 python script (replacing ClientLogin)

I have an App Engine project which:
uses google.appengine.api.get_current_user() to handle users (and login:required)
has a URL to collect some data (which requires login)
has Google users but on a custom domain
I used to have a script to pull the data using the old https://www.google.com/accounts/ClientLogin interface, but now that interface is deprecated, I'm trying to work out what I need to do to get OAuth2 working to access my App Engine URL with a user value set.
I have worked my way through OAuth2 for devices to get myself an access key for my script (i.e. I can run it, authenticate in a web browser, then poll for the access key), as described in OAuth2 For Devices.
But I'm not sure:
what scope I should be using to request the access_token compatible with get_current_user(),
how to pass this in my request to App Engine so that it can create the the user header, and
whether I need to modify my app to use this access_token, eg adding callbacks etc
With regards to the last point, user was set by google's front end infrastructure so I’m hoping that that same infrastructure can somehow convert my OAuth access_token into a login name without me needing to update my app to do the callback part, because it should all be in appengine's infrastructure right and user is set before the request comes to my app.

Forward naked domains

I recently purchased a domain with Yahoo Domains for my GAE app. Where I managed to get the domain mapped into my GAE account.
Now, since GAE does not support naked domains, I just placed the CNAME for www to point to Google App Engine.
Everything works fine now, i.e. my app can be accessed through http://www.my-example-domain.com
The problem is with naked domain (with Yahoo), I am trying to forward the naked domain http://my-example-domain.com to http://www.my-example-domain.com however, the domain manager is complaining that the forward is not possible.
What could be the problem that forward is not possible? Also, is there a way to solve this in GAE management console, since Yahoo domain manager seems to not able to handle this.
Hi Please try to do the following changes from your Google Apps Admin Console.
Go to this URL for Domain Management Settings in Google Apps Console.
Under the Domain Management. Click on change redirect and add www.example.com. Also check the attached screenshot for the same.
Also follow the instructions provided in the URL change A record below change redirect url.
After making these changes you will see the URL will get redirected automatically.

Redirect version.appidentifier.appspot.com to my own domain's subdomain

I have a GAE app and I have already been able to redirect appidentifier.appspot.com to my own domain's www subdomain and the naked domain. For example, if I owned foo.appspot.com and foo.com, then entering in www.foo.com or foo.com into the browser will render the contents of foo.appspot.com successfully. I configured all this using Google Apps on the Google side of things and NameCheap on the registrar side of things.
Now, I have made a new, non-default version of my GAE app. Let's call it dev.foo.appspot.com. How do I set up a URL forward (or what-not) so that I can access this GAE version by simply entering dev.foo.com into my browser?
What you are looking for to do is possible if you set up a wildcard subdomain mapping. This is well documented in the final section of Using a Custom Domain.

Resources