@kokuin/oauth 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exchange.js +3 -0
- package/lib/types.d.ts +7 -0
- package/package.json +1 -1
package/lib/exchange.js
CHANGED
|
@@ -84,5 +84,8 @@ function validateTokenResponse(value) {
|
|
|
84
84
|
if (record.scope !== undefined && typeof record.scope !== 'string') {
|
|
85
85
|
throw new Error('OAuth token response has an invalid scope');
|
|
86
86
|
}
|
|
87
|
+
if (record.id_token !== undefined && typeof record.id_token !== 'string') {
|
|
88
|
+
throw new Error('OAuth token response has an invalid id_token');
|
|
89
|
+
}
|
|
87
90
|
return value;
|
|
88
91
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -22,6 +22,13 @@ export type TokenResponse = {
|
|
|
22
22
|
expires_in?: number;
|
|
23
23
|
token_type: string;
|
|
24
24
|
scope?: string;
|
|
25
|
+
/**
|
|
26
|
+
* OpenID Connect ID token, returned by the token endpoint when `openid` is
|
|
27
|
+
* among the requested scopes. A signed JWT carrying the verified issuer and a
|
|
28
|
+
* stable subject id. Surfaced here so a caller can capture a provider-account
|
|
29
|
+
* fingerprint; this package does not decode or verify it.
|
|
30
|
+
*/
|
|
31
|
+
id_token?: string;
|
|
25
32
|
};
|
|
26
33
|
export type OAuthErrorCode = 'invalid_grant' | 'invalid_client' | 'invalid_request' | 'unauthorized_client' | 'unsupported_grant_type' | 'invalid_scope' | string;
|
|
27
34
|
export declare class OAuthTokenError extends Error {
|