Help

Re: Can I build a Mobile App that stores data in users AirTable account?

1785 0
cancel
Showing results for 
Search instead for 
Did you mean: 
antolikjan
4 - Data Explorer
4 - Data Explorer

I would like to build a mobile app that tracks user's habits and stores the data in AirTable account of the user.

I want to use react-native framework because I want the app to be able to store the data in different services (eg. google sheets). 

At the moment it isn't clear to me if the AirTable API policies will allow me to insert records into user's tables? 
My initial tests came accross Cross-Origin Resource Sharing issues. 

Can somebody enlighten me if what I am after is in principle possible?

Thank you.

4 Replies 4
Harsh2
6 - Interface Innovator
6 - Interface Innovator

Hi @antolikjan 

Are you using the OAuth method to allow your user's to grant you access to the Airtable API on their behalf?

If so, did you ensure to request "write" scope for the token?

I am using the Expo React Native framework to write the app. 

Upon successfully passing the first authorization step where user grants access to the table I am making following FETCH call to retrieve the authorization token:

// Exchange the authorization code for an access token
          method: 'POST',
          headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
          },
          body: JSON.stringify({
          grant_type: 'authorization_code',
          code: code,
          redirect_uri: redirectUri,
          code_verifier : state
     }),
})

Where code is the code returned by AirtableAPI in the first authorization step, and redirectUri and state match those with which I made the successful authorization call.

I get following response error:

Access to fetch at 'https://airtable.com/oauth2/v1/token' from origin 'http://localhost:19006' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.




Harsh2
6 - Interface Innovator
6 - Interface Innovator

Hi @antolikjan 

Based on the error it seems you are attempting to make the API call from the user's browser.

All API calls made during the OAuth process should be made from your server NOT browser

Try replicating the OAuth flow with Postman. It might involve some manual work in terms of creating the URL etc, but it should hopefully help you understand how Airtable is handling OAuth.

antolikjan
4 - Data Explorer
4 - Data Explorer

That is the point of my question - I am building an standalone Mobile App (there is no server), which would record daily habits and store them in user's Airtable table. Do I understand it correctly that this is essentially impossible, because I would have to have a separate back-end running on a server that would be handling this saving due to the Airtable API policies?