added refresh tocken
This commit is contained in:
@@ -95,6 +95,52 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/auth/refresh": {
|
||||
"post": {
|
||||
"description": "Get a new access token using a refresh token",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Refresh epta token",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Refresh token",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.RefreshRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.AuthResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/auth/register": {
|
||||
"post": {
|
||||
"description": "Create user account with username, email, password",
|
||||
@@ -146,6 +192,10 @@ const docTemplate = `{
|
||||
"internal_auth.AuthResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"refresh_token": {
|
||||
"type": "string",
|
||||
"example": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4="
|
||||
},
|
||||
"token": {
|
||||
"type": "string",
|
||||
"example": "eyJhbGciOiJIUzI1NiIs..."
|
||||
@@ -181,6 +231,18 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_auth.RefreshRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"refresh_token"
|
||||
],
|
||||
"properties": {
|
||||
"refresh_token": {
|
||||
"type": "string",
|
||||
"example": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4="
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_auth.RegisterRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
@@ -90,6 +90,52 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/auth/refresh": {
|
||||
"post": {
|
||||
"description": "Get a new access token using a refresh token",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"auth"
|
||||
],
|
||||
"summary": "Refresh epta token",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Refresh token",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.RefreshRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.AuthResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_auth.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/auth/register": {
|
||||
"post": {
|
||||
"description": "Create user account with username, email, password",
|
||||
@@ -141,6 +187,10 @@
|
||||
"internal_auth.AuthResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"refresh_token": {
|
||||
"type": "string",
|
||||
"example": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4="
|
||||
},
|
||||
"token": {
|
||||
"type": "string",
|
||||
"example": "eyJhbGciOiJIUzI1NiIs..."
|
||||
@@ -176,6 +226,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_auth.RefreshRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"refresh_token"
|
||||
],
|
||||
"properties": {
|
||||
"refresh_token": {
|
||||
"type": "string",
|
||||
"example": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4="
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_auth.RegisterRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
definitions:
|
||||
internal_auth.AuthResponse:
|
||||
properties:
|
||||
refresh_token:
|
||||
example: dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4=
|
||||
type: string
|
||||
token:
|
||||
example: eyJhbGciOiJIUzI1NiIs...
|
||||
type: string
|
||||
@@ -25,6 +28,14 @@ definitions:
|
||||
- email
|
||||
- password
|
||||
type: object
|
||||
internal_auth.RefreshRequest:
|
||||
properties:
|
||||
refresh_token:
|
||||
example: dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4=
|
||||
type: string
|
||||
required:
|
||||
- refresh_token
|
||||
type: object
|
||||
internal_auth.RegisterRequest:
|
||||
properties:
|
||||
email:
|
||||
@@ -117,6 +128,36 @@ paths:
|
||||
summary: Epta get current user
|
||||
tags:
|
||||
- auth
|
||||
/api/auth/refresh:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Get a new access token using a refresh token
|
||||
parameters:
|
||||
- description: Refresh token
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_auth.RefreshRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/internal_auth.AuthResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/internal_auth.ErrorResponse'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/internal_auth.ErrorResponse'
|
||||
summary: Refresh epta token
|
||||
tags:
|
||||
- auth
|
||||
/api/auth/register:
|
||||
post:
|
||||
consumes:
|
||||
|
||||
Reference in New Issue
Block a user