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.

getting "Status Code: 401 Unauthorized" from /hello

See original GitHub issue

Issue

getting “Status Code: 401 Unauthorized” from /hello in Chrome In the API console, i see:

{"name":"AzureAD: Bearer Strategy","hostname":"US-LT-10272","pid":1
5812,"level":30,"msg":"authentication failed due to: token is not found","time":"2022-08-23T23:57:02.462Z","v":0}
GET /hello 401 1.355 ms - -

I do see right before /hello is called, i see /token is called and it does return a token like:

{
	"id_token": "eyJ0eX....",
	"token_type": "Bearer",
	"not_before": 1661293983,
	"client_info": "eyJ1aW...",
	"scope": "",
	"refresh_token": "eyJraW...",
	"refresh_token_expires_in": 86400
}

So why isn’t it passing it along to /hello?

like /hello has a authorization token like so: authorization: Bearer and im guessing it should have a value like: authorization: Bearer eyJ0eX

Believe I setup everything according to spec in the Azure AD B2C settings for the App/Registration/UserFlows, and configured the config.js and authConfig.js with the simple updates mentioned in the tutorial as well.

Please provide us with the following information:

This issue is for the sample

    - [ ] 1-1) Sign-in with Azure AD
    - [ ] 1-2) Sign-in with Azure AD B2C
    - [ ] 2-1) Acquire a Token and call Microsoft Graph
    - [ ] 3-1) Protect and call a web API on Azure AD
    - [x] 3-2) Protect and call a web API on Azure AD B2C
    - [ ] 4-1) Deploy to Azure Storage and App Service
    - [ ] 4-2) Deploy to Azure Static App Service
    - [ ] 5-1) Call a web API using App Roles
    - [ ] 5-2) Call a web API using Security Groups
    - [ ] 6-1) Call Microsoft Graph using on-behalf-of flow
    - [ ] 6-2) Call a web API using Proof of Possession tokens
    - [ ] 6-3) Call a web API using Conditional Access Auth Context

This issue is for a

    - [x] bug report -> please search issues before submitting
    - [ ] question
    - [ ] feature request
    - [ ] documentation issue or request

Minimal steps to reproduce

Any log messages given by the failure

Request URL: http://localhost:5000/hello, Request Method: GET, Status Code: 401 Unauthorized

Expected/desired behavior

Request URL: http://localhost:5000/hello, Request Method: GET, Status Code: 200

Browser and version

Chrome 104.0.5112.81 (Official Build) (32-bit) Node v14.18.0

Thanks! We’ll be in touch soon.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
salman90commented, Aug 29, 2022

@armyofda12mnkeys No worries, I am happy to help. The colors are randomly generated if you do not upload a logo image for the app.

0reactions
armyofda12mnkeyscommented, Aug 27, 2022

If I may ask a side question before closing the ticket. Now that my app ‘works’, should it turn green on the main registration listing page: image Thought it was kinda weird its just grey (some inactive status?) and other apps there are green (active status?).

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP 401 Unauthorized Error | What Is and How to Fix?
401 Unauthorized Error is an HTTP response status code indicating the request sent by the user couldn't be authenticated. Get Know How to ......
Read more >
How to Quickly Fix the 401 Unauthorized Error (5 Methods)
The 401 (Unauthorized) status code indicates that the request has not been applied because it lacks valid authentication credentials for the ...
Read more >
What is “401 Error Unauthorized Access" and How to Fix it?
The HTTP code “401 Unauthorized Access” is a client-side error. It indicates that the website's server sends a “WWW-Authenticate ; Password protection may...
Read more >
401,"message":"An error occurred. Header not set."
Error 401 indicates: The session ID or OAuth token used has expired or is invalid. The response body contains the message and errorCode....
Read more >
401 Unauthorized - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 401 Unauthorized response status code indicates that the client request has not been completed ...
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