templates/Doc/authorization.html.twig line 1

Open in your IDE?
  1. {% extends 'Layouts/Doc/default.html.twig' %}
  2. {% block title %}Documentation{% endblock %}
  3. {% block headerPageTitle %}
  4.     {{ 'app.documentation.page.title.authorization'|trans |upper}}
  5. {% endblock %}
  6. {% block body %}
  7.     <div class="card mb-12">
  8.         <div class="card-body flex-column p-5">
  9.             <div class="d-flex align-items-center p-lg-15">
  10.                 <div class="row">
  11.                     <div class="col-md-12 scroll-y">
  12.                         <h1 class="fw-bold fs-4 fs-lg-1 text-gray-800 mb-3">Authorization</h1>
  13.                         <div class="position-relative w-100 text-gray-800">
  14.                             <p>In <strong>Popina Order's API</strong> all routes are protected by <strong>JWT authentication</strong>. If you would like to test these endpoints <strong><a href="{{ path('foxorders_api_doc') }}" target="_blank">in our Swagger UI docs</a></strong>, you need to retrieve a <strong>JWT token (duration = {{tokenDuration}} min)</strong> first. You could do that by using an endpoint with </strong>your credentials</strong> for API as webshop, manager or show owner:</p>
  15.                             <img alt="Login" class="mt-5" src="/{{ foxorders_doc_authorization ~ 'login-endpoint.png' }}" style="width: 914.25px"/>
  16.                             <p class="mt-5">In the response, you will get a token that has to be passed in each request header. In the Swagger UI, you can set the authentication token for each request.</p>
  17.                             <img alt="Login response" class="mt-5" src="/{{ foxorders_doc_authorization ~ 'login-response.png' }}" style="width: 914.25px"/>
  18.                         
  19.                             <p class="mt-5">Notice the <strong>Authorize</strong> button and unlocked padlock near the available URLs:</p>
  20.                             <img alt="Authorize" class="mt-5" src="/{{ foxorders_doc_authorization ~ 'authorize.png' }}" style="width: 914.25px"/>
  21.                             <p class="mt-5">Click the <strong>Authorize</strong> button and put the authentication token (remember about the <strong>Bearer</strong> prefix):</p>
  22.                             <img alt="Bearer authorization" class="mt-5" src="/{{ foxorders_doc_authorization ~ 'bearer-authorization.png' }}" style="width: 914.25px"/>
  23.                             <p class="mt-5">After clicking <strong>Authorize</strong>, you should see locked padlock near URLs and the proper header should be added to each API call:</p>
  24.                             <img alt="After authorization" class="mt-5" src="/{{ foxorders_doc_authorization ~ 'after-authorization.png' }}" style="width: 914.25px"/>
  25.                         </div>
  26.                     </div>
  27.                 </div>
  28.             </div>
  29.             <div class="d-flex align-items-center p-lg-15">
  30.                 <div class="row">
  31.                     <div class="col-md-12 scroll-y">
  32.                         <h1 class="fw-bold fs-4 fs-lg-1 text-gray-800 mb-3">Refresh Token</h1>
  33.                         <div class="position-relative w-100 text-gray-800">
  34.                             <p>A vital component in our authentication system, enabling secure and seamless user access management.</p>
  35.                             <ul>
  36.                                 <li>
  37.                                     <strong>Endpoint: {{api_route_prefix}}/token/refresh</strong>
  38.                                 </li>
  39.                             </ul>
  40.                             <p>Parameters</p>
  41.                             <ul>
  42.                                 <li>
  43.                                     <strong>refresh_token</strong>: The refresh token is obtained alongside the authentication token.
  44.                                 </li>
  45.                                 <li>
  46.                                     <strong>franchiseId</strong>: The franchise ID you intend to log in to.
  47.                                 </li>
  48.                             </ul>
  49.                             <p>Response</p>
  50.                             <ul>
  51.                                 <li>
  52.                                     <strong>Token</strong>: Authentication token (duration = {{tokenDuration}} min).
  53.                                 </li>
  54.                                 <li>
  55.                                     <strong>refresh_token</strong>: Refresh token (duration = {{refreshTokenDuration}} min).
  56.                                 </li>
  57.                             </ul>
  58.                         </ul>
  59.                     </div>
  60.                 </div>
  61.                 <div class="row">
  62.                     <div class="col-md-12 pt-5 scroll-y">
  63.                         <h1 class="fw-bold fs-4 fs-lg-1 text-gray-800 mb-3">Headers</h1>
  64.                         <div class="position-relative w-100 text-gray-800">
  65.                             <p>Each endpoint you call must contain <strong>the mandatory headers</strong>.</p>
  66.                             <p>The mandatory headers are the folowing:</p>
  67.                             <ul>
  68.                                 <li>
  69.                                     <strong>version</strong>: The API's version you like to use. The version changes from time to time when adding new feature or after fixing bugs. Available versions are (<strong>2.0.0</strong>).
  70.                                 </li>
  71.                                 <li>
  72.                                     <strong>source</strong>: The source of your request to help us identify which one requesting this endpoint. Available versions are (<strong>popina</strong>, <strong>kezia-cloud</strong>, <strong>jalia</strong> and <strong>foxorders-front</strong>).
  73.                                 </li>
  74.                                 <li>
  75.                                     <strong>franchise-token</strong>: To identify the franchise from which the request was made, this is a <strong>mandatory and blocking</strong> parameter for some endpoints. The token is used to ensure the <strong>legitimacy</strong> of the request.
  76.                                 </li>
  77.                                 <li>
  78.                                     <strong>shop-token</strong>: To be able to retrieve the default device token if the deviceToken parameter not communicated in the header. This is a <strong>mandatory and blocking</strong> parameter for some endpoints.
  79.                                 </li>
  80.                                 <li>
  81.                                     <strong>device-token</strong>: Each device (cash desk/terminal) has its own token. This is a <strong>mandatory and blocking</strong> parameter for some endpoints. For others if this parameter is not communicated, it takes the default value from <strong>shopToken</strong> parameter (<strong>C&C</strong>).
  82.                                 </li>
  83.                             </ul>
  84.                         </div>
  85.                     </div>
  86.                 </div>
  87.                 <div class="row">
  88.                     <div class="col-md-12 pt-5 scroll-y">
  89.                         <h1 class="fw-bold fs-4 fs-lg-1 text-gray-800 mb-3">Google authentication</h1>
  90.                         <div class="position-relative w-100 text-gray-800">
  91.                             <p>
  92.                                 <strong>Popina Order</strong>
  93.                                 provides seamless and secure authentication through Google accounts. With our Google authentication integration, users can easily sign up and sign in to your application using their Google credentials. This enhances the user experience by eliminating the need to create and remember additional login details.
  94.                             </p>
  95.                         </div>
  96.                     </div>
  97.                 </div>
  98.                 <div class="row">
  99.                     <div class="col-md-12 pt-5 scroll-y">
  100.                         <h1 class="fw-bold fs-4 fs-lg-1 text-gray-800 mb-3">Rate limiter</h1>
  101.                         <div class="position-relative w-100 text-gray-800">
  102.                             <p><strong>Rate limiter</strong> is a method of controlling traffic flow to a service or server by restricting the number of requests that can be made within a certain time frame. It is an essential technique for preventing resource abuse, ensuring fair use of services and protecting against <strong>DDoS</strong> attacks.</p>
  103.                             <p>The current Rate limit for <strong>Popina Order</strong> is: <strong>{{rateLimiterLimit}} / {{rateLimiterInterval}}</strong></p>
  104.                         </div>
  105.                     </div>
  106.                 </div>
  107.             </div>
  108.         </div>
  109.     </div>
  110. {% endblock %}