Wiki source code of 1. Authorization
Last modified by Giorgi Mdivnishvili on 2024/04/26 15:59
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | (% data-xwiki-non-generated-content="java.util.List" %) | ||
2 | ((( | ||
3 | |||
4 | ))) | ||
5 | |||
6 | {{box cssClass="floatinginfobox" title="**Contents**"}} | ||
7 | {{toc/}} | ||
8 | {{/box}} | ||
9 | |||
10 | = Authorization: Starting Your Integration = | ||
11 | |||
12 | The first step in integrating with our API is the authorization process. As a developer, you'll be assigned a unique username and password. These credentials are essential for generating the access token, a critical component that must be included in the headers of all subsequent API requests. This token validates your requests and grants you access to the full suite of our services. | ||
13 | |||
14 | |||
15 | == Request URL - [POST] == | ||
16 | |||
17 | (% class="box infomessage" %) | ||
18 | ((( | ||
19 | [[https:~~/~~/integration.kazunion.com/api/Auth/Auth>>https://integration.kazunion.com/api/Auth/Auth]] | ||
20 | ))) | ||
21 | |||
22 | |||
23 | == Request Parameters == | ||
24 | |||
25 | (% class="box" %) | ||
26 | ((( | ||
27 | none | ||
28 | ))) | ||
29 | |||
30 | |||
31 | == Request Body == | ||
32 | |||
33 | {{code language="Json"}} | ||
34 | { | ||
35 | "login": "string", | ||
36 | "password": "string" | ||
37 | } | ||
38 | {{/code}} | ||
39 | |||
40 | |||
41 | == Response Body == | ||
42 | |||
43 | {{code language="Json"}} | ||
44 | { | ||
45 | "accessToken": "string", | ||
46 | "refreshToken": "string", | ||
47 | "passwordExpired": true | ||
48 | } | ||
49 | {{/code}} | ||
50 | |||
51 | |||
52 | expiration time 30 days for both tokens: | ||
53 | |||
54 | accessToken - 43200 min | ||
55 | |||
56 | refreshToken - 2591968 sec | ||
57 | |||
58 | |||
59 | === Schema === | ||
60 | |||
61 | (% data-xwiki-non-generated-content="java.util.List" %) | ||
62 | ((( | ||
63 | |||
64 | ))) | ||
65 | |||
66 | {{success}} | ||
67 | AuthResponse{ | ||
68 | |||
69 | |accessToken|string | ||
70 | nullable: true | ||
71 | |refreshToken|string | ||
72 | nullable: true | ||
73 | |passwordExpired|boolean | ||
74 | |||
75 | } | ||
76 | {{/success}} | ||
77 | |||
78 | |||
79 | |||
80 | |||
81 | = RefreshToken = | ||
82 | |||
83 | |||
84 | To retrieve an existing accesstoken , you can make a request for the given endpoint below and pass in the body refreshToken, after that you will receive an accessToken. You can use this method at your discretion. | ||
85 | |||
86 | |||
87 | == Request URL - [POST] == | ||
88 | |||
89 | (% class="box infomessage" %) | ||
90 | ((( | ||
91 | [[https:~~/~~/integration.kazunion.com/api/Auth/RefreshToken>>https://integration.kazunion.com/api/Auth/RefreshToken]] | ||
92 | ))) | ||
93 | |||
94 | |||
95 | == Request Parameters == | ||
96 | |||
97 | (% class="box" %) | ||
98 | ((( | ||
99 | none | ||
100 | ))) | ||
101 | |||
102 | |||
103 | == (% id="cke_bm_5539S" style="display:none" %) (%%)Request Body example == | ||
104 | |||
105 | {{code language="Json"}} | ||
106 | { | ||
107 | "refreshToken": "string" | ||
108 | } | ||
109 | {{/code}} | ||
110 | |||
111 | |||
112 | == (% id="cke_bm_11208S" style="display:none" %) (%%)Response Body == | ||
113 | |||
114 | {{code language="Json"}} | ||
115 | { | ||
116 | "accessToken": "string", | ||
117 | "refreshToken": "string", | ||
118 | "passwordExpired": true | ||
119 | } | ||
120 | {{/code}} | ||
121 | |||
122 | |||
123 | == Important == | ||
124 | |||
125 | {{error}} | ||
126 | === Implementing Authorization in Subsequent Requests === | ||
127 | |||
128 | For every API request after the initial authentication, it's crucial to include the authorization token in the request header. This ensures your requests are authorized and can access the necessary resources. Here's how to properly include your token: | ||
129 | |||
130 | * **Header Key:** Authorization | ||
131 | * **Header Value:** Bearer [Your Token Here] - Use the bearer token provided in the initial authentication response. The authorization type should be specified as Bearer Token. | ||
132 | |||
133 | Additionally, to ensure your requests are properly formatted and recognized, include the following headers: | ||
134 | |||
135 | * **Content-Type:** Specify this header as application/json to indicate the format of the request body. | ||
136 | * **Header Key:** X-nugios-timezone | ||
137 | * **Header Value:** 240 - Adjust this value to match your local timezone offset in minutes. | ||
138 | |||
139 | Incorporating these headers with their respective values is essential for the successful processing of your API requests. | ||
140 | {{/error}} |