Skip to content

Commit

Permalink
Add a better description for the api key
Browse files Browse the repository at this point in the history
Some endpoints that are not related to the users can be used without
the api key changing the Solidus configuration.
Add the instruction to do it.
  • Loading branch information
vassalloandrea committed Jan 20, 2023
1 parent c6050d7 commit 4a689de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions api/openapi/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ curl --header "Authorization: Bearer 1a6a9936ad150a2ee345c65331da7a3ccc2de" http

By default, API keys are only generated for admins, but you can easily customize Solidus to generate them for all users, which is useful for instance if you want users to be able to sign in and manage their profile via the API.

The `API key` is mandatory for each endpoint by default. You can change this configuration [with the Spree::Api::Config.requires_authentication preference](https://github.com/solidusio/solidus/blob/2b79f72aa53f5caa850c587888fff46c1c91f7b7/api/lib/spree/api_configuration.rb#L5) to avoid the default behavior and expose some endpoints without an API key. An example could be the [GET product list](https://solidus.stoplight.io/docs/solidus/08307f3d809e7-list-products) endpoint.

### Order token

For allowing guests to manage their cart and place their order, you can use the order's guest token. This token is contained in the `guest_token` property of the order, and it allows you to perform certain checkout-related operations on the order such as managing line items, completing the checkout flow etc.
Expand Down
7 changes: 4 additions & 3 deletions api/openapi/solidus-api.oas.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
openapi: 3.0.3
x-stoplight:
docs:
showModels: false
info:
title: Solidus API
version: '1.0'
Expand All @@ -8,9 +11,6 @@ info:
url: 'https://solidus.io'
license:
name: ''
x-stoplight:
docs:
showModels: false
paths:
/products:
get:
Expand Down Expand Up @@ -5928,6 +5928,7 @@ components:
type: apiKey
name: Authorization
in: header
description: 'The `API key` is mandatory for each endpoint by default. You can change this configuration [with the Spree::Api::Config.requires_authentication preference](https://github.com/solidusio/solidus/blob/2b79f72aa53f5caa850c587888fff46c1c91f7b7/api/lib/spree/api_configuration.rb#L5) to avoid the default behavior and expose some endpoints without an API key. An example could be the [GET product list](https://solidus.stoplight.io/docs/solidus/08307f3d809e7-list-products) endpoint.'
order-token:
type: apiKey
name: X-Spree-Order-Token
Expand Down

0 comments on commit 4a689de

Please sign in to comment.