Skip to content
This repository was archived by the owner on Sep 7, 2020. It is now read-only.
This repository was archived by the owner on Sep 7, 2020. It is now read-only.

rootToken injected in function context should be configurable #289

Open
@marktani

Description

@marktani

Issue by sorenbs
Wednesday Oct 18, 2017 at 08:52 GMT
Originally opened as https://github.com/graphcool/prisma/issues/879


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 prisma/prisma1#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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions