Add dynamic API keys for function executions by Meldiron · Pull Request #7512 · appwrite/appwrite · GitHub
Skip to content

Add dynamic API keys for function executions - #7512

Merged
christyjacob4 merged 14 commits into
1.6.xfrom
feat-function-tokens
May 24, 2024
Merged

christyjacob4 merged 14 commits into
1.6.xfrom
feat-function-tokens

Conversation

@Meldiron

@Meldiron Meldiron commented Jan 29, 2024 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Introduces API Tokens to function executions. They are automatically provided short-liked JWT tokens that developer can use instead of creating and maintaining API keys for their functions.

Test Plan

  • Implement new tests

Related PRs and Issues

x

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Comment thread app/config/collections.php Outdated
Comment thread app/controllers/api/functions.php Outdated
Comment thread app/controllers/api/functions.php Outdated
Comment thread app/controllers/general.php Outdated
@eldadfux eldadfux added product / functions Fixes and upgrades for the Appwrite Functions. version / 1.6 labels Feb 18, 2024
Comment thread app/controllers/shared/api.php Outdated
Comment thread src/Appwrite/Platform/Workers/Functions.php Outdated
@Meldiron
Meldiron requested a review from eldadfux May 9, 2024 11:51
Comment thread .env
Comment thread src/Appwrite/Platform/Workers/Functions.php
@Meldiron
Meldiron changed the base branch from main to 1.6.x May 17, 2024 16:16
Comment thread app/init.php
Comment on lines +286 to +291

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we save this API key to the db as well? How do we validate this key?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decode JWT to get projectId and scopes. We then set those on the Auth of the request.

Comment thread app/controllers/shared/api.php
@christyjacob4
christyjacob4 merged commit 3ae4ed2 into 1.6.x May 24, 2024
@christyjacob4
christyjacob4 deleted the feat-function-tokens branch May 24, 2024 10:45
@stnguyen90 stnguyen90 changed the title Feat: API Tokens Add dynamic API keys for function executions Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product / functions Fixes and upgrades for the Appwrite Functions.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants