FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use Bearer token - instead of Basic authentication by divyavanmahajan · Pull Request #126 · databricks/databricks-sql-nodejs · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .js  (1) .md  (1) .ts  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
19 changes: 12 additions & 7 deletions docs/readme.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@

## Table of Contents

1. [Foreword](#foreword)
2. [Example](#example) \
2.1. [Error handling](#error-handling)
3. [DBSQLSession](#dbsqlsession)
4. [DBSQLOperation](#dbsqloperation)
5. [Status](#status)
6. [Finalize](#finalize)
- [Getting started](#getting-started)
- [Table of Contents](#table-of-contents)
- [Foreword](#foreword)
- [Example](#example)
- [Error handling](#error-handling)
- [DBSQLSession](#dbsqlsession)
- [DBSQLOperation](#dbsqloperation)
- [Example](#example-1)
- [Status](#status)
- [Finalize](#finalize)

## Foreword

The library is written using TypeScript, so the best way to get to know how it works is to look through the code [lib/](/lib/), [tests/e2e](/tests/e2e/) and [examples](/examples).

If you find any mistakes, misleading or some confusion feel free to create an issue or send a pull request.

The token can be a workspace PAT token or an Azure AD access token. To generate an AAD token, use the command line `az account get-access-token --resource 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d` or use the MSAL authentication library with `scope = 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default`.

## Example

```javascript
Expand Down
2 changes: 1 addition & 1 deletion lib/connection/auth/PlainHttpAuthentication.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ export default class PlainHttpAuthentication implements IAuthentication {
}

private getToken(username: string, password: string): string {
return `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`;
return `Bearer ${password}`;
}
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('PlainHttpAuthentication', () => {
const transportMock = {
setOptions(name, value) {
expect(name).to.be.eq('headers');
expect(value.Authorization).to.be.eq('Basic YW5vbnltb3VzOmFub255bW91cw==');
expect(value.Authorization).to.be.eq('Bearer anonymous');
},
};
return auth.authenticate(transportMock).then((transport) => {
Expand Down

Back | FazBrowse Home | New Git URL