Cartodb: Auth API: guide about working with views and regular API keys

Created on 3 May 2018  ·  12Comments  ·  Source: CartoDB/cartodb

After several discussions around Auth API, I have detected the pattern of people trying to restrict access to partial information from datasets. E.g., I have a clients dataset, I just want to build an application with _clients from NYC area_.

Using PostgreSQL and Auth API, you could create a view of your dataset with —basic or geospatial— constraints and grant access to a regular API key to that view. This avoid creating a separate table that you have to keep in sync with your original clients dataset.

My view:

CREATE VIEW clients_nyc AS (SELECT * FROM clients WHERE ...);

My API key:

{
  "name": "Clients-NYC",
  "grants": [
    {
      "type": "apis",
      "apis": [
        "maps"
      ]
    },
    {
      "type": "database",
      "tables": [
        {
          "schema": "public",
          "name": "clients_nyc",
          "permissions": [
            "select"
          ]
        }
      ]
    }
  ]
}

It would be nice to create a guide about how to do this.

documentation engine enhancement

All 12 comments

@oriolbx @jsanz this theme is that one we discussed at the time of the Auth release. I think you have been working with some clients this way. Do you think we can start writing a draft on the staging of the developer center?

Yes, @jsanz detected this pattern some time ago with the Auth API too. :) I think that we could start the documentation draft for the usage of the Auth API.

yeah, that'd be super useful

@oriolbx do you mind start rolling the ball? :smile:

Since we (CARTO Solutions Team) should be doing this procedure more and more, it'd be great for you to have a chat with @inigomedina on the best way to tackle the guide contribution process and eventually explain to the rest of the team afterward.

Ok! :)

Awesome! Now we just need to fix that url, right? 😛

--
Jorge Sanz
CARTO - Predict through location

Sent from my phone, excuse my brevity and typos

El mié., 16 may. 2018 8:52, Oriol notifications@github.com escribió:

Already on
https://carto.com/developers/auth-api/guides/Authorizaration-CARTO-views/


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/CartoDB/cartodb/issues/13920#issuecomment-389414002,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AALfaHbd3uqtl-ZxU1jDqWNbZAnH9ZZ0ks5ty8y0gaJpZM4TxHZc
.

Awesome, @oriolbx. 👏

Let's fix the url, and then use this resource in any conversation through support related to a similar problem, so that this resource becomes the first response.

@oriolbx, can you fix that URL? 🙏

Sure, what should be the correct URL?

From guides/Authorizaration-CARTO-views/ to guides/Authorization-for-CARTO-views/. Look at the typo in Authorizaration, it's also present in the left menu.

Pull request has been merged but the changes haven't been applied yet

Was this page helpful?
0 / 5 - 0 ratings