File tree Expand file tree Collapse file tree 8 files changed +11
-16
lines changed Expand file tree Collapse file tree 8 files changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ const bitbucket = new Bitbucket(clientOptions)
149
149
const clientOptions = {
150
150
authStrategy: ' OAuth' ,
151
151
auth: {
152
- grant_type: ' urn:bitbucket:oauth2:jwt ' ,
152
+ grant_type: ' bitbucketCloudJWTGrant ' ,
153
153
jwt_token: ' jwt_token' ,
154
154
},
155
155
}
Original file line number Diff line number Diff line change @@ -3,13 +3,13 @@ import { request } from '../request'
3
3
import { getEndpointOptions } from './get-endpoint-options'
4
4
5
5
type APIClient = import ( './types' ) . APIClient
6
- type BitbucketOptions = import ( './types' ) . BitbucketOptions
6
+ type Options = import ( './types' ) . Options
7
7
type Plugin = import ( './types' ) . Plugin
8
8
type RequestHook = import ( './types' ) . RequestHook
9
9
10
10
export function constructor (
11
11
plugins : Plugin [ ] ,
12
- clientOptions : BitbucketOptions = { }
12
+ clientOptions : Options = { }
13
13
) : APIClient {
14
14
const requestHook : RequestHook = new Singular ( )
15
15
const requestDefaults = getEndpointOptions ( clientOptions , requestHook )
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { lowerCaseHeaderFields } from '../utils/lower-case-header-fields'
4
4
import { pick } from './utils/pick'
5
5
6
6
type EndpointParams = import ( './types' ) . EndpointParams
7
- type Options = import ( './types' ) . BitbucketOptions
7
+ type Options = import ( './types' ) . Options
8
8
type RequestHook = import ( './types' ) . RequestHook
9
9
10
10
export function getEndpointOptions (
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ type HTTPError = import('../error/types').HTTPError
5
5
type Request = import ( '../request/types' ) . Request
6
6
type Response < T > = import ( '../request/types' ) . Response < T >
7
7
8
- export interface BitbucketOptions {
8
+ export interface Options {
9
9
type ?: any
10
10
auth ?: any
11
11
authStrategy ?: string
@@ -23,11 +23,11 @@ export interface APIClient {
23
23
[ key : string ] : any
24
24
}
25
25
26
- export type Plugin = ( client : APIClient , options : BitbucketOptions ) => void
26
+ export type Plugin = ( client : APIClient , options : Options ) => void
27
27
28
28
export interface APIClientFactory {
29
- new ( options ?: BitbucketOptions ) : APIClient
30
- ( options ?: BitbucketOptions ) : APIClient
29
+ new ( options ?: Options ) : APIClient
30
+ ( options ?: Options ) : APIClient
31
31
32
32
plugins ( plugins : Plugin [ ] ) : APIClientFactory
33
33
}
Original file line number Diff line number Diff line change 1
1
export type APIClient = import ( '../../../client/types' ) . APIClient
2
- export type Options = import ( '../../../client/types' ) . BitbucketOptions
2
+ export type Options = import ( '../../../client/types' ) . Options
3
3
export type RequestOptions = import ( '../../../endpoint/types' ) . RequestOptions
4
4
export type AuthOptions = import ( '../types' ) . OAuthOptions
5
5
Original file line number Diff line number Diff line change 1
1
export type APIClient = import ( '../../../client/types' ) . APIClient
2
- export type Options = import ( '../../../client/types' ) . BitbucketOptions
2
+ export type Options = import ( '../../../client/types' ) . Options
3
3
export type RequestOptions = import ( '../../../endpoint/types' ) . RequestOptions
4
4
5
5
type AuthHeaders = {
Original file line number Diff line number Diff line change @@ -10,11 +10,6 @@ const routes = getOAuthRoutes(oAuth2Spec)
10
10
function authenticatePlugin ( client : APIClient , clientOptions : Options ) : void {
11
11
client . registerEndpoints ( { oauth : routes . getToken } )
12
12
13
- // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance
14
- // is unauthenticated. The `this.auth()` method is a no-op and no request hook is registered.
15
- // (2) If only `options.auth` is set, use the default token authentication strategy.
16
- // (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance.
17
-
18
13
if ( ! clientOptions . auth ) return
19
14
switch ( clientOptions . authStrategy ) {
20
15
case 'OAuth' :
Original file line number Diff line number Diff line change 1
1
export type APIClient = import ( '../../client/types' ) . APIClient
2
- export type Options = import ( '../../client/types' ) . BitbucketOptions
2
+ export type Options = import ( '../../client/types' ) . Options
3
3
export type RequestOptions = import ( '../../endpoint/types' ) . RequestOptions
4
4
5
5
export type AuthBasic = {
You can’t perform that action at this time.
0 commit comments