Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Netlify-specific context to Remix server actions #1835

Merged

Conversation

anmonteiro
Copy link
Contributor

Motivation

At Netlify, we're gearing up to launch the Netlify Graph, which allows easy access to third-party APIs via the Onegraph acquisition.

What does this PR do?

This PR adds a custom getLoadContext function to the Netlify server template which gets at most 2 pieces of information from the function invocation:

  1. netlifyGraphToken, which is passed to handlers that fetch remote third-party data (check our docs here).
  2. clientNetlifyGraphAccessToken, which is extracted from the Authorization request header, if present. This might be in JWT form, containing signed information about the client. This short video goes into great detail about the workflows this can allow.

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Feb 8, 2022

Hi @anmonteiro,

Welcome, and thank you for contributing to Remix!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Feb 8, 2022

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@ryanflorence
Copy link
Member

@anmonteiro thanks so much for the PRs :)

We've anticipated each host will have unique features like this and we'll never be able to keep track of them all ourselves. Do ya'll want to own the netlify adapter? We'll keep the CLI option but we'll use the netlify adapter from your published package.

@ryanflorence ryanflorence changed the base branch from main to dev February 8, 2022 19:30
@ryanflorence ryanflorence changed the base branch from dev to main February 8, 2022 19:30
@ryanflorence
Copy link
Member

@anmonteiro can you rebase this on dev instead of main and we'll get it merged? Thanks!

@anmonteiro anmonteiro changed the base branch from main to dev February 8, 2022 19:39
@anmonteiro anmonteiro force-pushed the anmonteiro/netlify-graph-token branch from 984a293 to f03345b Compare February 8, 2022 19:45
@anmonteiro anmonteiro force-pushed the anmonteiro/netlify-graph-token branch from f03345b to 8e61982 Compare February 8, 2022 19:48
@anmonteiro
Copy link
Contributor Author

@ryanflorence thx for the review. I just rebased this on dev.

I think we'd be happy to move this to the Netlify org. Tagging @sgrove and @localden here for visibility.

@ryanflorence ryanflorence merged commit 13d2135 into remix-run:dev Feb 8, 2022
@anmonteiro anmonteiro deleted the anmonteiro/netlify-graph-token branch February 8, 2022 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants