Forum Discussion

zach1's avatar
zach1
New Member
3 years ago

Can't get past 401 `No authorization token provided` using bearer auth

Hi,

 

I'm attempting to set up bearer authorization for a single endpoint via openapi 3.0. Relevant code:

paths:
/accounts/current:
get:
tags:
- accounts

summary: Gets current account
operationId: get_current_account
security:
- BearerAuth: []

responses:
200:
description: Successfully retrieved the current account.

content:
application/json:
schema:
$ref: '#/components/schemas/AccountResponse'
x-openapi-router-controller: accounts_controller

x-manager-class: accounts_manager
components:
securitySchemes:
BearerAuth:
type: http

scheme: bearer
bearerFormat: JWT

Everything goes fine until I try to actually call the endpoint, for example:

 

curl -H "Content-type: application/json" -H "Authorization: Bearer <TOKEN>" localhost:5000/v1/accounts

 

No matter what I do I'm just getting this:

 

{
    "detail": "No authorization token provided",
    "status": 401,
    "title": "Unauthorized",
    "type": "about:blank"
}

 

 What am I missing? I'm yet to find any additional info from the docs but I may be overlooking it... Any help appreciated!

No RepliesBe the first to reply