Skip to content

Conversation

@stb13579
Copy link
Contributor

What does it do?

Add GraphQL API and link in the API token documentation to match the user guide documentation.

Why is it needed?

responding to a Discord user question.

Related issue(s)/PR(s)

Let us know if this is related to any issue/pull request

@stb13579 stb13579 self-assigned this Nov 18, 2022
@vercel
Copy link

vercel bot commented Nov 18, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
documentation ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Dec 22, 2022 at 9:38AM (UTC)
documentation-docu-mvp ❌ Failed (Inspect) Dec 22, 2022 at 9:38AM (UTC)

@stb13579 stb13579 added source: Dev Docs PRs/issues targeting the Developer Docs pr: updated content PRs updating existing documentation content target: v4 Documentation PRs/issues targeting content from docs.strapi.io (main branch). size: small If the PR includes only 1 file with <10 lines of text or a small code fix labels Nov 18, 2022
@stb13579 stb13579 added this to the 4.5.2 milestone Nov 18, 2022
@stb13579 stb13579 requested a review from pwizla November 29, 2022 10:26
Copy link
Collaborator

@pwizla pwizla left a comment

Choose a reason for hiding this comment

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

Thanks, Shaun.
How would one pass the API token along with the GraphQL query or mutation? I don't think it's documented somewhere, could you please check (maybe with @Convly) how it works?

@pwizla pwizla added the internal PRs created by the Strapi core team label Nov 30, 2022
@pwizla pwizla modified the milestones: 4.5.3, 4.6.0-beta.1, 4.5.4 Nov 30, 2022
@innerdvations
Copy link
Collaborator

Thanks, Shaun. How would one pass the API token along with the GraphQL query or mutation? I don't think it's documented somewhere, could you please check (maybe with @Convly) how it works?

It works with an authorization header, I believe in exactly the same way as the REST API, but I think it's worth repeating in the graphql documentation.

It might also be helpful to add a note for how to do that with the Graphql Playground. Here's an explanation: https://docs.wellline.com/wellline-recipes/timeline-service-graphql-api/using-the-graphql-playground-1

@pwizla pwizla modified the milestones: 4.5.4, 4.5.5 Dec 14, 2022
Copy link
Contributor

@gpene gpene left a comment

Choose a reason for hiding this comment

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

LGTM


Then on each request, send along an `Authorization` header in the form of `{ "Authorization": "Bearer YOUR_JWT_GOES_HERE" }`. This can be set in the HTTP Headers section of your GraphQL Playground.

### API tokens
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be at the ## level so that it doesn't fall under the "Users and Permissions Plugin" section, since API tokens are an alternate option to the plugin?

Although, I wonder if this could be combined or simplified somehow (maybe outside the scope of what you're doing, but a future note). That is, the authorization header works exactly the same whether it's a JWT or API Token. So we could have a section about "Adding an authorization header" that explains the bearer token is either an API Token, or the JWT returned from a login.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct, I fixed the header level.

On the second point, I agree and it is something we can revisit in the next quarter. We have been discussing a concepts section with @Aurelsicoko and one of the topics that I think we should cover early on is authentication/authorization.

stb13579 and others added 2 commits December 22, 2022 09:33
ben's comments

Co-authored-by: Ben Irvin <ben@innerdvations.com>
@stb13579 stb13579 merged commit 0889254 into main Dec 22, 2022
@stb13579 stb13579 deleted the dev/api-token-gql branch December 22, 2022 09:42
@strapi-bot
Copy link

This pull request has been mentioned on Strapi Community Forum. There might be relevant details there:

https://forum.strapi.io/t/new-documentation-release-v4-5-5/24573/1

pwizla added a commit that referenced this pull request Feb 15, 2023
pwizla added a commit that referenced this pull request Feb 15, 2023
Adds the missing part in config > API tokens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal PRs created by the Strapi core team pr: updated content PRs updating existing documentation content size: small If the PR includes only 1 file with <10 lines of text or a small code fix source: Dev Docs PRs/issues targeting the Developer Docs target: v4 Documentation PRs/issues targeting content from docs.strapi.io (main branch).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants