Socket
Socket
Sign inDemoInstall

google-auth-library

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-auth-library - npm Package Compare versions

Comparing version 9.10.0 to 9.11.0

16

build/src/auth/oauth2client.d.ts

@@ -43,2 +43,11 @@ /// <reference types="node" />

}
/**
* The client authentication type. Supported values are basic, post, and none.
* https://datatracker.ietf.org/doc/html/rfc7591#section-2
*/
export declare enum ClientAuthentication {
ClientSecretPost = "ClientSecretPost",
ClientSecretBasic = "ClientSecretBasic",
None = "None"
}
export interface GetTokenOptions {

@@ -368,2 +377,8 @@ code: string;

issuers?: string[];
/**
* The client authentication type. Supported values are basic, post, and none.
* Defaults to post if not provided.
* https://datatracker.ietf.org/doc/html/rfc7591#section-2
*/
clientAuthentication?: ClientAuthentication;
}

@@ -379,2 +394,3 @@ export type RefreshOptions = Pick<AuthClientOptions, 'eagerRefreshThresholdMillis' | 'forceRefreshOnFailure'>;

readonly issuers: string[];
readonly clientAuthentication: ClientAuthentication;
_clientId?: string;

@@ -381,0 +397,0 @@ _clientSecret?: string;

33

build/src/auth/oauth2client.js

@@ -16,3 +16,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.OAuth2Client = exports.CertificateFormat = exports.CodeChallengeMethod = void 0;
exports.OAuth2Client = exports.ClientAuthentication = exports.CertificateFormat = exports.CodeChallengeMethod = void 0;
const gaxios_1 = require("gaxios");

@@ -35,2 +35,12 @@ const querystring = require("querystring");

})(CertificateFormat || (exports.CertificateFormat = CertificateFormat = {}));
/**
* The client authentication type. Supported values are basic, post, and none.
* https://datatracker.ietf.org/doc/html/rfc7591#section-2
*/
var ClientAuthentication;
(function (ClientAuthentication) {
ClientAuthentication["ClientSecretPost"] = "ClientSecretPost";
ClientAuthentication["ClientSecretBasic"] = "ClientSecretBasic";
ClientAuthentication["None"] = "None";
})(ClientAuthentication || (exports.ClientAuthentication = ClientAuthentication = {}));
class OAuth2Client extends authclient_1.AuthClient {

@@ -59,2 +69,4 @@ constructor(optionsOrClientId, clientSecret, redirectUri) {

};
this.clientAuthentication =
opts.clientAuthentication || ClientAuthentication.ClientSecretPost;
this.issuers = opts.issuers || [

@@ -132,10 +144,19 @@ 'accounts.google.com',

const url = this.endpoints.oauth2TokenUrl.toString();
const headers = {
'Content-Type': 'application/x-www-form-urlencoded',
};
const values = {
client_id: options.client_id || this._clientId,
code_verifier: options.codeVerifier,
code: options.code,
client_id: options.client_id || this._clientId,
client_secret: this._clientSecret,
grant_type: 'authorization_code',
redirect_uri: options.redirect_uri || this.redirectUri,
grant_type: 'authorization_code',
code_verifier: options.codeVerifier,
};
if (this.clientAuthentication === ClientAuthentication.ClientSecretBasic) {
const basic = Buffer.from(`${this._clientId}:${this._clientSecret}`);
headers['Authorization'] = `Basic ${basic.toString('base64')}`;
}
if (this.clientAuthentication === ClientAuthentication.ClientSecretPost) {
values.client_secret = this._clientSecret;
}
const res = await this.transporter.request({

@@ -146,3 +167,3 @@ ...OAuth2Client.RETRY_CONFIG,

data: querystring.stringify(values),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
headers,
});

@@ -149,0 +170,0 @@ const tokens = res.data;

2

build/src/index.d.ts

@@ -14,3 +14,3 @@ import { GoogleAuth } from './auth/googleauth';

export { Impersonated, ImpersonatedOptions } from './auth/impersonated';
export { Certificates, CodeChallengeMethod, CodeVerifierResults, GenerateAuthUrlOpts, GetTokenOptions, OAuth2Client, OAuth2ClientOptions, RefreshOptions, TokenInfo, VerifyIdTokenOptions, } from './auth/oauth2client';
export { Certificates, CodeChallengeMethod, CodeVerifierResults, GenerateAuthUrlOpts, GetTokenOptions, OAuth2Client, OAuth2ClientOptions, RefreshOptions, TokenInfo, VerifyIdTokenOptions, ClientAuthentication, } from './auth/oauth2client';
export { LoginTicket, TokenPayload } from './auth/loginticket';

@@ -17,0 +17,0 @@ export { UserRefreshClient, UserRefreshClientOptions, } from './auth/refreshclient';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GoogleAuth = exports.auth = exports.DefaultTransporter = exports.PassThroughClient = exports.PluggableAuthClient = exports.DownscopedClient = exports.BaseExternalAccountClient = exports.ExternalAccountClient = exports.IdentityPoolClient = exports.AwsClient = exports.UserRefreshClient = exports.LoginTicket = exports.OAuth2Client = exports.CodeChallengeMethod = exports.Impersonated = exports.JWT = exports.JWTAccess = exports.IdTokenClient = exports.IAMAuth = exports.GCPEnv = exports.Compute = exports.DEFAULT_UNIVERSE = exports.AuthClient = exports.gaxios = exports.gcpMetadata = void 0;
exports.GoogleAuth = exports.auth = exports.DefaultTransporter = exports.PassThroughClient = exports.PluggableAuthClient = exports.DownscopedClient = exports.BaseExternalAccountClient = exports.ExternalAccountClient = exports.IdentityPoolClient = exports.AwsClient = exports.UserRefreshClient = exports.LoginTicket = exports.ClientAuthentication = exports.OAuth2Client = exports.CodeChallengeMethod = exports.Impersonated = exports.JWT = exports.JWTAccess = exports.IdTokenClient = exports.IAMAuth = exports.GCPEnv = exports.Compute = exports.DEFAULT_UNIVERSE = exports.AuthClient = exports.gaxios = exports.gcpMetadata = void 0;
// Copyright 2017 Google LLC

@@ -43,2 +43,3 @@ //

Object.defineProperty(exports, "OAuth2Client", { enumerable: true, get: function () { return oauth2client_1.OAuth2Client; } });
Object.defineProperty(exports, "ClientAuthentication", { enumerable: true, get: function () { return oauth2client_1.ClientAuthentication; } });
var loginticket_1 = require("./auth/loginticket");

@@ -45,0 +46,0 @@ Object.defineProperty(exports, "LoginTicket", { enumerable: true, get: function () { return loginticket_1.LoginTicket; } });

{
"name": "google-auth-library",
"version": "9.10.0",
"version": "9.11.0",
"author": "Google Inc.",

@@ -36,3 +36,3 @@ "description": "Google APIs Authentication Client Library for Node.js",

"@types/node": "^20.4.2",
"@types/sinon": "^10.0.0",
"@types/sinon": "^17.0.0",
"assert-rejects": "^1.0.0",

@@ -60,3 +60,3 @@ "c8": "^8.0.0",

"puppeteer": "^21.0.0",
"sinon": "^15.0.0",
"sinon": "^18.0.0",
"ts-loader": "^8.0.0",

@@ -63,0 +63,0 @@ "typescript": "^5.1.6",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc