question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: Bearer auth

See original GitHub issue

Hey! Bearer auth (eg. Authorization: Bearer SOME_API_KEY) is the most commonly used type of authorization header if i’m not wrong. It would be great to have a bearer auth middleware like BasicAuth.

I’m currently using a hardcoded version myself, so having a built-in one will help save a lot time.

Thanks

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
waptikcommented, Jun 4, 2022

Hi @waptik !

I’ve implemented Bearer Auth middleware in this PR #299 . If you can, please check whether it is what you expect. Usage is below:

import { Hono } from 'hono'
import { bearerAuth } from 'hono/bearer-auth'

const app = new Hono()

const token = 'honoisacool'

app.use('/auth/*', bearerAuth({ token }))

app.get('/auth/page', (c) => {
  return c.text('You are authorized')
})

app.fire()

Hey @yusukebe,

Yup, that’s what I expect it to be. When it’s released, I’ll test it in production and give you feedback

0reactions
yusukebecommented, Jun 4, 2022

Hi @waptik !

I’ve implemented Bearer Auth middleware in this PR #299 . If you can, please check whether it is what you expect. Usage is below:

import { Hono } from 'hono'
import { bearerAuth } from 'hono/bearer-auth'

const app = new Hono()

const token = 'honoisacool'

app.use('/auth/*', bearerAuth({ token }))

app.get('/auth/page', (c) => {
  return c.text('You are authorized')
})

app.fire()
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Feature Request] Expose `Authorization: Bearer` token when ...
I think the best solution will involve us creating an internal OIDC forward auth handler that allows Authelia performing the OpenID Connect ...
Read more >
Feature: Bearer Authentication | Squid Web Cache wiki
Bearer is an HTTP authentication scheme created as part of OAuth 2.0 in RFC 6750. A client wanting to access to a service...
Read more >
Authorizing requests - Postman Learning Center
Bearer tokens enable requests to authenticate using an access key, such as a JSON Web Token (JWT). The token is a text string,...
Read more >
Bearer Authentication - Swagger
The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string,...
Read more >
Generating and using app-only Bearer Tokens | Docs
A bearer token allows developers to have a more secure point of entry for using the Twitter APIs, and are one of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found