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.

API invoke need authentication information

See original GitHub issue

i try to call api by reading the doc: https://github.com/linkedin/WhereHows/tree/datahub/datahub-frontend

but it response with 401 Unauthorized how i can pass the authentication information? i have little knowledge for ember.js framework.

[op@my-200 WhereHows]$ curl -v http://localhost:9001/api/v2/browse?type=dataset
* About to connect() to localhost port 9001 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 9001 (#0)
> GET /api/v2/browse?type=dataset HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:9001
> Accept: */*
> 
< HTTP/1.1 401 Unauthorized
< Date: Thu, 19 Dec 2019 01:52:54 GMT
< Content-Length: 0
< 
* Connection #0 to host localhost left intact

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
emailstonlcommented, Sep 22, 2020

one option can be as below

  1. Authenticate and write cookie in text file
  2. use cookie from file to call api.
user@machine:~/git/datahub/docker$ curl -i -c cookie1.txt -d '{"username":"datahub", "password":"datahub"}' -H 'Content-Type: application/json' http://localhost:9001/authenticate
HTTP/1.1 200 OK
Set-Cookie: PLAY_SESSION=50dd1d9ea331dad76338731f6dd3bac7a12a58f7-auth_token=ZGF0YWh1YjoxNjAwNzYxMTUwMTgxOjcwN0UyOUU5QkFCRkYxMkRFOEJBNjAyMDI4NkM0M0E1MzgxRkNDMkY1NDkwNTZCQTY0Q0U0NzRCMjIwN0MwMzY%3D&uuid=3b8bcdaa-5340-4731-a205-fcbc5f44e083&user=datahub; SameSite=Lax; Path=/; HTTPOnly
Date: Tue, 22 Sep 2020 07:52:30 GMT
Content-Type: application/json
Content-Length: 91

{"status":"ok","data":{"username":"datahub","uuid":"3b8bcdaa-5340-4731-a205-fcbc5f44e083"}}

user@machine:~/git/datahub/docker$ curl -i -b cookie1.txt http://localhost:9001/api/v2/browse?type=dataset&path=/prod
[1] 30079
user@machine:~/git/datahub/docker$ HTTP/1.1 200 OK
Date: Tue, 22 Sep 2020 07:52:58 GMT
Content-Type: application/json
Content-Length: 101

{"elements":[],"start":0,"count":0,"total":0,"metadata":{"totalNumEntities":0,"path":"","groups":[]}}
1reaction
mars-lancommented, Aug 27, 2020

@cptran777 let’s update the doc to include a section on this. A few screenshots will help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best practices for REST API security: Authentication and ...
You'll need to store users' OAuth credentials. Don't put them in local storage—that can be accessed by any JavaScript running on the page!...
Read more >
API authentication and authorization - Idratherbewriting.com
One popular method for authenticating and authorizing users is OAuth 2.0. This approach relies on an authentication server to communicate with ...
Read more >
Controlling and managing access to a REST API in API Gateway
API Gateway supports multiple mechanisms for controlling and managing access to your API. You can use the following mechanisms for authentication and ...
Read more >
Access and authentication for the REST API
All REST API calls must be authenticated. Instead of passing the full credentials on every REST API call, REST uses a token. The...
Read more >
Most Popular API Authentication Methods | 3Pillar Global
Application Programming Interfaces (APIs)—the vital links that allow applications to exchange services and data—require authentication ...
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