AppEngine API client-authentification stopped working after update - javascript

I have a Java app engine backend with a web client and an Android client. The Android client uses the generated client library and the website the JavaScript client library for the endpoints.
We have 3 environments on app engine: Dev, Staging and Production.
I already pushed the update to dev and it is working on the app and the website.
Now I have updated the backend on the Staging environment and I get a lot of authentification problems. There is nothing changed in the authentification or the signing of the app so I don't understand what it can be.
Website client
The website uses G+ login and after calling a method of the custom app engine API it gives the following error:
"Access Not Configured. has not been used in project 986034197583 before or it is disabled. Enable it by visiting [url] then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
The discovery#restDescription is succesful and it shows the methods.
Android client
The Android app also uses G+ login and gives the following errors (in the log of the Google Cloud Console):
com.google.api.server.spi.auth.GoogleJwtAuthenticator authenticate: ClientId is not allowed: 986034197583-51qasim2gmqql5vc652vk3u3lpapegb6.apps.googleusercontent.com
The app is not signed with another keystore and the SHA-1 hash is the same (I checked it).
API Manager Credentials
The credentials in the API manager stayed the same and should not have to change. I checked them all and they look correct. This makes no sense to me unless Google has some stupid failure or something today.
APIs Explorer
When I test the API with the APIs Explorer it is working. (apis-explorer.appspot.com)
It looks like the API credentials are not linked to my API any more. I find it strange that you nowhere can enable or disable your own APIs (only the Google ones). The link in the error to activate the API does not work because it is a link as if it is a Google API.

Turns out there was something wrong with the backend configuration. I only replaces the appengine-web.xml with the staging configuration. But I did not change the clientID and the weblientId of the backend because they are in a file named Constants.java where I have to manually set if it is a DEV, STAGING or PRODUCTION backend (aarggh). This was still marked as DEV.
We really need a buildscript for this backend to prevent situations like this. Because I'm an Android developer I only know gradle. This project was developed by a Java developer who leaved the company and now I have to maintain this. It uses Maven so I don't know how I can make different build targets like in Android Studio where different Constants are used.
Maybe somebody here knows how I can make a simular solution like flavours in gradle with and generated BuildConfig.java Constants. That would be great.
Edit
I'm now creating maven profiles now in combination with the maven-war-plugin I can make different profiles for the different build types. This is usable for the different appengine-web.xml
See: web.xml configuration based on Maven profile
I'm now still trying too find something to include the Constants for ANDROID_CLIENT_ID and WEB_CLIENT_ID in the build script. I can't load them from a file because they have to be constants because they are used in attributes for the API's.
I generate the Contstants.java with http://www.mojohaus.org/templating-maven-plugin/. Only thing I can't get to work is that it does not generate it automaticcaly when swithing profile. I still have to manually start templating:filter-sources.

Related

How to deploy add-on of google app script in Google Workspace Marketplace

I am new to Google App Script. I have done coding in the google script app. I have deployed the app by the deploy option which is available in the google app script. After deployment, I am not able to find my add-on in Google Workspace Marketplace.
Is there any way to use an add-on without publishing it?
I have deployed the add-on with the deploy option which is available in the app script.
You need to publish an Add-on to find it on Markeplace
For this follow the steps as explained in the documentation
Deploying your script as an Add-on is only one of the several steps you need to follow
Apart from this, you need to create a project in the Google Cloud Console
Bind your script to this project
Set-up the OAuth screen for the project. Depending on either you would like to publish a privat or public Add-on - you might need to submit your [OAuth screen and the used scopes] for verification
Then, you need to enable and configure the Marketplace SDK in your Cloud project
You need to deploy your script as an Add-on (this is the step you already did) and indicate the script id and deployment number within the Marketplace SDK tab APP CONFIGURATION
Specify if you would like to deploy a private or public Add-on
Complete the rest of the configuration and the STORE LISTING tab
If you are intending to publish a public Add-on - you need to submit it for verification and get an approval. If it's a private one (only accesible for your domain), you can publish it straightaway and will see the URL to the Marketplace listing.
As you see, the steps to publish an Add-on onGoogle Marketplace are quite laborous.
To use the Add-on without publishing it, you can use it in testing mode as described here for Google Worskpace Addons and here for Editor Addons. Keep in mind that the testing mode has some limitations.

How To Run a Flutter Web Application Offline?

I got a problematic assignment from my employers.
I was given the task of developing simple software that will run strictly on Google Chrome,
without attempting to connect to the web (Security reasons).
I know flutter development and I feel comfortable with the sdk.
How should I develop a web app that can be deployed using a usb stick?
Looks like PWA can be an option, but the documentation is lacking in detail.
The system does not have the ability to run a local web server.
The Flutter app must be able to work with JS libraries, I intend to use jsQR.
service workers and indexedDB could help you for develop offline route app and offline api.
mdn docs for service workers
I'm not sure that this will fit your particular case: you say that the system can't run a local webserver, but what if you provide the webserver along with your software?
I just discovered get_server: you can find it here. It aims to allow developers to host their own HTTP server by using only flutter, without resorting to external tools or other coding/scripting languages. It allows also (and that's the relevant part) to wrap your flutter web app and make it run on local network.
For now I only tried with a very simple example, but it seems to be working. These are the steps I took:
create a new flutter project: since I needed the webserver to run on Windows, I had to get flutter ready for that (see here for help)
add get_server to the new pubspec.yaml
run flutter build web on your flutter web project, and copy the build/web output
folder in the root folder of the new project (I renamed the folder while copying since flutter might change the content of the web folder)
delete all the content of lib/main.dart
paste this (this the actual content of main.dart)
import 'package:get_server/get_server.dart' as gs;
void main() {
gs.runApp(
gs.GetServerApp(home: gs.FolderWidget('folderName')),
);
}
folderName is the name of the renamed folder containing the flutter web app build.
I ran this on Windows 'device' from AndroidStudio, and my original flutter web app was reachable at localhost:8080 (for now I just used the default options of get_server). I also got the webserver (empty) GUI as a white window: I guess that can be useful for some information regarding the server itself, although, if that windows closes, localhost:8080 becomes unavailable.
But, once released, you should be able to just run the executable from the USB stick, and then connect to it with Chrome.
PS: after some time using GetServer, I had to switch to other packages because of not-so-good docs and support. Now I'm using shelf, but also Alfred is a notable mention.

How to update my cordova/phonegap mobile application remotely in android?

I have written the mobile app in cordova + angularjs + sqlite. I need to distribute it directly from my server to devices not through the google play.
Now I need to update javascript files stored in www directory on android device. I tried file transfer from app directory (/data/data/my.application.directory/) to some public device directory or server and vice versa - no problem. But problem is the www directory is part of file:///android_asset/ that is read only so I am not able to store any data in there.
Any idea? Thanks.
This is the way I'm using for updating my app and I'm not using Google Play or other stores:
I'm using this cordova plugin : https://github.com/whiteoctober/cordova-plugin-app-version to check my actual app version
cordova.getAppVersion.getVersionNumber().then(function (version)
{
if(version)
// Check the server reference version
});
After, I'm sending the app version number to the server
The server checks the difference between the version sent and the reference version
If the device app version is older, I'm returning the new version to my app client
You provide little information about your application, your code and what you are trying to do, but let me try to help you either way.
If what you want to do is modifying files in the www directory in android clients already shipped/downloaded, forget about it, you would need direct access to the device, and this code is bundled when you ship it.
If you are looking for a hot code push solution, there might be a way of doing so installing additional cordova plugins
When you publish your application on the store - you pack in it all your web content: html files, JavaScript code, images and so on. There are two ways how you can update it:
Publish new version of the app on the store. But it takes time,
especially with the App Store.
Sacrifice the offline feature and load all the pages online. But as
soon as Internet connection goes down - application won't work.
Solution: install cordova-hot-code-push

android app with apache cordova

I'm developing a web app using HTML5,CSS3 and JavaScript.
Then I want to use the Apache ordova platform to generate a native android app from my web app but I still don't understand what do I need for this,specially do I need a server-side development with php for example??
First off i suggest you read this
Pretty much your app will be able to accomplish a little bit more than what you would be able to do in a browser if all you had available was the ability to write html/js*.
*by this i mean that you have access to device-specific hardware which is not available in a browser and a few more things but pretty much that's it.
You will need to install node.js (or io.js), then install cordova through npm, and make sure you have the Android SDK installed. Once you create your project, your html/css/js will be wrapped into a native webview component, you do not need any server to render it, effectively your app is a native app that can be installed from google play.
You will need a server, typically a RESTful API, if your app needs to query data remotely or persist to some third party. If you are thinking through a classic MVC mindset (render a page through some php code) then you probably need to read about cordova and how it works. A cordova app is a client-side only app, no server-side processing is possible unless through a network communication to a server you have access to on the internet. You can do persistence locally (to the android device) and even use a local database, but remember that this db exists on the device, so you won't be able to share information between users unless you somehow coordinate that through your app (and most likely a server-side app / rest api).
It is unlikely that your existing web app can be wrapped into a cordova app straight away, cordova apps are single page apps mostly.

Javascript : Run client side EXE by CHROME [duplicate]

My requirement is to launch my installed application from chrome browser if it is installed on client machine, If not installed then I wanted to start download. What is best recommended solution for chrome?
So fare i tried following
used NPAPI, but due to deprecation of NPAPI by chrome I can't use.
Checked PNacl and Pepper API both API not providing access to local file system to launch an application. They just port my C/C++ code in browser and run it in browser environment with sandbox restrictions.
Is it true only option i have is to use native messaging? Or is there any other option for simple task to launch my application from our url,
Regarding “Native Messaging”
Do users need to install my extension
Do i need to add my extension to chrome store
How to deal with Registry permissions for non admin users
Can i install extension to chrome along with my app installation
Note :- Found some providers use “External Protocol Request” to launch application but there are no enough resources where can i found more about this
Thanks and Regards,
Pravin
For what its worth,
see here - http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/nativeMessaging/
the README indicates that Native Messaging can now be added even by non-Admins.
But it appears Native Messaging will only work for Extensions: "Extensions can exchange messages with native applications(...)" and I dont imagine you can expect all of your users to do that.
To open it if it's installed you just need to register your application (at the OS level, so the details will vary by OS; you don't say what OS you are targeting) as a handler for some specific scheme, then have your page open that scheme. That's the same flow that causes mailto: links to open a user's mail client, for instance.
If you have a chrome app, you can use inline install: https://developer.chrome.com/webstore/inline_installation

Categories