• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SImple Stand-Alone Applicatiopn with a Local Only DataBase
#1
Can you explain how I can create a simple stand-alone application that does not use Cloud Data Storage?
I know that I can do local data calls only, to the local device, but how would the user of this Local Stand-alone application by-pass the log-on?
What would be the code that bypasses the need to log-in to the application and where would I put it?
Can you please provide a sample?
  Reply
#2
(01-18-2020, 04:30 PM)clarencemartin Wrote: Can you explain how I can create a simple stand-alone application that does not use Cloud Data Storage?
I know that I can do local data calls only, to the local device, but how would the user of this Local Stand-alone application by-pass the log-on?
What would be the code that bypasses the need to log-in to the application and where would I put it?
Can you please provide a sample?

Hi Clarence,

cdb_auth needs to be called regardless of cloud or local storage. Local auth will attempt to decrypt files on disk with the credentials provided. If you want the app to be completely offline, you have a couple options in this case.

1. create a shared user and give the credentials to your users. all users will use the same email and password to login
2. create a shared user and hardcode the credentials in your code

The following is an example of the login process assuming you are hardcoding the credentials:

Code:
on openCard
    local tStatusA
   
    get cdb_auth("user@default.com", "password", "user")
   
    if not cdb_result() then
         answer "There was a problem authorizing user: " & cdb_result("response")
    else
         put cdb_authStatus() into tStatusA
         
         if tStatusA["local"] is true then
              cdb_loadTable
             
              #Your user can now use the app offline
              #Now you can go to the next card or show the UI after the login is successful
         else
              #You shouldn't fall into this case but I like having it for sanity check
              answer "You do not have access to the app offline."
         end if
    end if
end openCard
  Reply
#3
Thanks
  Reply
#4
Thanks for the code @efrain.c...

just to clarify, online access is required no matter if database is local or cloud? (ie you can't authenticate against local user credentials?).
So if no internet access, no access to local DB?


I ask because in the course of using the example login authentication generated by the auto-project, it logs events in message box:
Code:
(2020-09-07 16:50:37.207): Local authentication unsure: no local data to verify
(2020-09-07 16:50:37.878): Cloud authentication - received nonse value
(2020-09-07 16:50:38.205): Cloud authentication - received apiKey
(2020-09-07 16:50:38.205): Cloud authentication passed

Which in my mind implies local authentication is possible...
  Reply
#5
Hi stamatis,

Internet access is only required if there is no local data.

A user's email and password are used to encrypt their local data. Local data is separated by user emails. Calling cdb_auth will attempt to use the given credentials to decrypt a local file in the user's space. Being able to decrypt the files means the user has been authenticated.

If there is no internet and there is no local data then a user cannot be authenticated.

If there is internet but no local data, passing cloud authentication also grants local authentication. A user will have to create local data in this state before they can authenticate subsequent times without internet.
  Reply
#6
(09-08-2020, 06:02 PM)efrain.c Wrote: Hi stamatis,

Internet access is only required if there is no local data.

A user's email and password are used to encrypt their local data. Local data is separated by user emails. Calling cdb_auth will attempt to use the given credentials to decrypt a local file in the user's space. Being able to decrypt the files means the user has been authenticated.

If there is no internet and there is no local data then a user cannot be authenticated.

If there is internet but no local data, passing cloud authentication also grants local authentication. A user will have to create local data in this state before they can authenticate subsequent times without internet.

Thank you again efrain.c...
To be honest, this became more obvious from your other reply regarding local databases.

I think many coming to this may, like myself, have the mindset of using SQL or Filemaker data stores where it's possible to have an entirely local solution or a networked solution.

For me, what wasn't entirely clear was that in liveCloud you can only create a cloud database - this can be synced to a local DB, but in effect it's a cloud based and not a local solution. Once i got this clear in my head, all of the above makes absolute sense...
  Reply
#7
Hi stamatis and Efrain,
I think Stamatis does'nt understand that with LiveCloud, you use the Cloud component to build the Database that can be used locally without having to have cloud access for the project. ie, stand alone applications can be built for local data use only once it is built. All of the API's needed for the local only data applicaation are included.
I hope that my understanding is correct?
ie: once built you do not need the cloud.
  Reply
#8
That's correct, Clarence.

The data model for an app has to be created on the cloud. You can then export the toolkit and have an app be completely offline/local. All the CRUD operations can be performed on local data by passing "local" to the APIs.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)