Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

rootToken injected in function context should be configurable #879

Closed
sorenbs opened this issue Oct 18, 2017 · 1 comment
Closed

rootToken injected in function context should be configurable #879

sorenbs opened this issue Oct 18, 2017 · 1 comment

Comments

@sorenbs
Copy link
Member

sorenbs commented Oct 18, 2017

All functions get a rootToken injected int the context::

{
  graphcool: {
    rootToken
  }
}

By default, rootToken contains a Temporary Root Token that is valid for 5 minutes.

See #740 for token terminology

For a given function it should be possible to configure a named Root Token to be injected instead of a Temporary Root Token. It should also be possible to not inject a Root Token at all:

Inject named Root Token

This configuration injects the Root Token with the name authenticate:

functions:
  authenticteCustomer:
    handler:
      code:
        src: ./code/authenticate.js
    context:
      rootToken: authenticate
    type: schemaExtension
    schema: ./code/authenticate.graphql

rootTokens:
- authenticate

Note: In the future it will be possible to control the scope of a Root Token. This feature will make it more relevant to use a named Root Token

No Root Token

This configuration disables Root Token injection:

functions:
  authenticteCustomer:
    handler:
      code:
        src: ./code/authenticate.js
    context:
      rootToken: null
    type: schemaExtension
    schema: ./code/authenticate.graphql

rootTokens:
- authenticate

When no Root Token is injected, the rootToken field will be omitted from the context.

Note: In the future we might make it possible to configure the default behaviour for root token injection.

@marktani
Copy link
Contributor

This issue has been moved to graphcool/graphcool-framework.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants