DA7: APIs and webhooks

Lesson 3 of 5 ยท reading 15โ€“25 minutes; practice and project time is on the module page

Signing in to APIs

๐ŸŽฏYou'll be able to

Sign in with API keys, bearer tokens, basic auth and OAuth, using the least access needed.

๐Ÿ The everyday picture

Some buildings let you in with a staff card. Some give a visitor pass that expires at 6 pm. Some ask the person you're visiting to come down and vouch for you. APIs use similar methods.

๐Ÿ“˜What it really is

๐Ÿ“A worked example

Sharma Textiles' integrations by sign-in method:

System Method Notes
ShipFast courier API key in header Separate test and live keys
Payment gateway Key ID and secret (basic auth) Test mode keys for building
Google Sheets OAuth 2.0 or service account Access to two named sheets
CRM OAuth 2.0 with scopes contacts.read, contacts.write, deals.write

When setting up the CRM, the consent screen asked for "full account access" by default. You changed the requested scopes to the three the workflows use.

๐ŸŒWhere it's used

๐Ÿ“Case scenario

A workflow worked for weeks, then every call to a marketing tool returns 401. The person who connected it changed their password, which revoked the app's OAuth tokens. You reconnect it using a shared business account, note the dependency in the credentials list from DA6, and add the 401 to the alert rules so it reaches the credential's owner.

๐Ÿ–ฑ๏ธTry it

For each system your workflows connect to, write its sign-in method, where the secret is stored, which scopes or permissions it has, and whether it expires.

โš ๏ธCommon mistakes

๐Ÿ› ๏ธFor your project

The simulator uses basic auth for the gateway and bearer tokens for accounts and CRM. Project 1 test 8 simulates an expired token.

โœ…Quick check

What does a refresh token do in OAuth 2.0?

Show the answer

It lets the platform get new access tokens without the user signing in again.

Why request the smallest set of scopes?

Show the answer

So a leaked or misused token can do as little harm as possible.

โ† PreviousMaking requests with the HTTP Request node
ProLearners Assist