Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Add scope examples to Authorisation API Docs. (#11365)
Matthew Kennedy60e9d6b87c82
diff --git a/api/docs/oauth/index.yml b/api/docs/oauth/index.ymlindex ed58727aab..08b16caeeb 100644--- a/api/docs/oauth/index.yml+++ b/api/docs/oauth/index.yml@@ -1,4 +1,4 @@-openapi: 3.0.0+openapi: 3.0.3servers:- url: 'https://demo.spreecommerce.org'description: demo@@ -7,7 +7,7 @@ servers:info:version: 1.0.0title: Authentication- description: "Spree uses oAuth based Authentication via short-lived Bearer tokens. You can either create a new one or refresh existing token."+ description: Spree uses oAuth based Authentication via short-lived Bearer tokens. You can either create a new one or refresh existing token.contact:name: Spark Solutionsurl: 'https://sparksolutions.co'@@ -18,26 +18,37 @@ info:paths:/spree_oauth/token:post:- description: Creates or refreshes a Bearer token required to authorize API calls+ description: |-+ This endpoint creates a new Bearer Token or refreshes an existing Bearer Token.++ The `token` found in the response body is required to authorize API calls.tags:- Token- operationId: Create or Refresh Token+ operationId: create-or-refresh-tokenresponses:'200':- description: Token was successfully created or refreshed+ description: Token was successfully created or refreshed.content:application/json:schema:$ref: '#/components/schemas/Token'examples:- create token:+ Storefront User Token:value:access_token: SfM3k8kq5Wkc6xz6rgMlsl-mbygJ1ptq4DR0Ah51vjAtoken_type: Bearerexpires_in: 7200refresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8kcreated_at: 1581873931- refresh token:+ Platform User Token:+ value:+ access_token: 2480c16561d1391ea81ca5336b651e9a29f4524f6dee8c7f3f02a600159189c3+ token_type: Bearer+ expires_in: 7200+ refresh_token: f5d78642252eeb3f3001f67b196ac21a27afc030462a54060b0ebbdae2b8dc9c+ scope: admin+ created_at: 1539863418+ Refreshed Token:value:access_token: Es9lLPW2mVaDB80I-I_OdQCw3JfOT1s19YN1naFWx98token_type: Bearer@@ -53,19 +64,40 @@ paths:- $ref: '#/components/schemas/CreateTokenBody'- $ref: '#/components/schemas/RefreshTokenBody'examples:- create token:+ Create Storefront User Token:value:grant_type: passwordusername: [email protected]password: spree123- refresh token:+ Create Platform User Token:+ value:+ grant_type: password+ username: [email protected]+ password: spree123+ scope: admin+ Refresh a Token:value:grant_type: refresh_tokenrefresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8kdescription: ''+ summary: Create or Refresh a Tokencomponents:schemas:Token:+ x-examples:+ create token:+ access_token: SfM3k8kq5Wkc6xz6rgMlsl-mbygJ1ptq4DR0Ah51vjA+ token_type: Bearer+ expires_in: 7200+ refresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8k+ created_at: 1581873931+ refresh token:+ access_token: Es9lLPW2mVaDB80I-I_OdQCw3JfOT1s19YN1naFWx98+ token_type: Bearer+ expires_in: 7200+ refresh_token: j92BxulqIIYtiiaBsuAM1TzGsGSVxaykT4kk8OYHGNY+ created_at: 1581876572+ type: objectproperties:access_token:type: string@@ -81,34 +113,39 @@ components:refresh_token:type: stringexample: f5d78642252eeb3f3001f67b196ac21a27afc030462a54060b0ebbdae2b8dc9c+ scope:+ type: string+ example: admin+ default: admincreated_at:type: integerexample: 1539863418- x-examples:- create token:- access_token: SfM3k8kq5Wkc6xz6rgMlsl-mbygJ1ptq4DR0Ah51vjA- token_type: Bearer- expires_in: 7200- refresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8k- created_at: 1581873931- refresh token:- access_token: Es9lLPW2mVaDB80I-I_OdQCw3JfOT1s19YN1naFWx98- token_type: Bearer- expires_in: 7200- refresh_token: j92BxulqIIYtiiaBsuAM1TzGsGSVxaykT4kk8OYHGNY- created_at: 1581876572+ required:+ - access_token+ - token_type+ - expires_in+ - refresh_token+ - created_at+ x-internal: trueCreateTokenBody:type: objectx-examples:- example-1:+ User Token:grant_type: passwordusername: [email protected]password: spree123+ Application Token:+ grant_type: password+ username: [email protected]+ password: spree123+ scope: adminproperties:grant_type:type: string- default: password- description: Use `password` to create a token and `refresh_token` to refresh it+ description: 'Use `password` to create a new token, or `refresh_token` to refresh an existing token.'+ enum:+ - password+ - refresh_tokenusername:type: stringdescription: User email address@@ -117,10 +154,17 @@ components:type: stringdescription: User passwordexample: spree123+ scope:+ type: string+ enum:+ - admin+ description: 'Pass the value `admin` to create a Platform User Token, allowing access to the Platform API.'+ nullable: truerequired:- grant_type- username- password+ x-internal: trueRefreshTokenBody:type: objectproperties:@@ -130,7 +174,7 @@ components:refresh_token:type: stringdescription: Refresh token obtained from the create token response- example: "27af95fd57a424e5d01aaf5eab1324a8d5c0ca57daf384fae39f811a5144330143301'"+ example: 27af95fd57a424e5d01aaf5eab1324a8d5c0ca57daf384fae39f811a5144330143301'required:- grant_type- refresh_token@@ -138,3 +182,6 @@ components:example-1:grant_type: refresh_tokenrefresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8k+ x-internal: true+tags:+ - name: Token