Access login protected third party endpoint

Is there an example using the wix api to send the contents of a form to a Google spreadsheet instead of the wix dataset collection? Or, an example of accessing any remote service where I might want to protect my login info. I know I can do this in node.js - how do I do it in wix?

Thanks.

Hi,

Currently, you can only use ’ fetch ’ method for requests.
This means that you need your third parties to have a REST API.

Liran.

Liran:

Yes, there’s a REST api, for example the append method for a google spreadsheet:
https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append

This would be a private spreadsheet though and I’d need to setup a OAuth 2.0 session for access:
https://developers.google.com/identity/protocols/OAuth2

The problem is where to store the private key - obviously not in the client side Javascript.
Is there access to some form of server side scripting?

Otherwise, I assume the answer is: We do not support authenticated sessions where the user needs to keep the credentials private.

Thanks, Jacob.

Is there also a REST API for the OAUTH? if so, let’s continue with that…
In terms of security, I think that saving the key is not a Wix Code concern.
You should make some research about how it is done on a regular web apps.

Just some thoughts about it…
I don’t know enough about the implementation of OAUTH2, so I’m not even sure it’s a public/private key implementation. But if so, in my opinion, a private key should never be sent over the web… this means that it should be created on the reading side and stay there (that’s why I think It’ll be hard to find such REST API). With the private key, a public key should be created too, and is safe to be sent over the web.
That way, you create an asynchronous encryption which allows everyone to hold and use your public key for encryption, and allow only the private key holder to decrypt de data.

Liran.

Jotform.com lets you send information from their forms to google spreadsheet. I found this trying to figure out how to integrate jotform’s or google spreadsheets with the wix database.

Thanks for the comments

Regarding:

In terms of security, I think that saving the key is not a Wix Code concern.

For the next person, I found this solution to my problem:

For example,
"Your code may have security risks if it runs client-side "
" You need this code to run server-side for two reasons

  1. It includes your API key to the third-party service, which you don’t want to expose in the client."

This allows me to secure the google spreadsheets api key as a server side call.