Comparing version 0.5.0 to 0.6.0
@@ -17,2 +17,3 @@ export { Apple } from "./providers/apple.js"; | ||
export type { GitHubTokens, GitHubUser, PrivateGitHubUser, PublicGitHubUser } from "./providers/github.js"; | ||
export type { GitLabTokens, GitLabUser } from "./providers/gitlab.js"; | ||
export type { GoogleRefreshedTokens, GoogleTokens, GoogleUser } from "./providers/google.js"; | ||
@@ -19,0 +20,0 @@ export type { LineIdTokenClaims, LineRefreshedTokens, LineTokens, LineUser } from "./providers/line.js"; |
@@ -37,3 +37,3 @@ import { TimeSpan, createDate } from "oslo"; | ||
headers: { | ||
Authorization: ["Bearer", accessToken].join(" ") | ||
Authorization: `Bearer ${accessToken}` | ||
} | ||
@@ -40,0 +40,0 @@ }); |
@@ -38,3 +38,3 @@ import { TimeSpan, createDate } from "oslo"; | ||
headers: { | ||
Authorization: ["Bearer", accessToken].join(" ") | ||
Authorization: `Bearer ${accessToken}` | ||
} | ||
@@ -41,0 +41,0 @@ }); |
@@ -33,3 +33,3 @@ import { OAuth2Client } from "oslo/oauth2"; | ||
headers: { | ||
Authorization: ["Bearer", accessToken].join(" ") | ||
Authorization: `Bearer ${accessToken}` | ||
} | ||
@@ -36,0 +36,0 @@ }); |
@@ -41,3 +41,3 @@ import { TimeSpan, createDate } from "oslo"; | ||
const request = new Request("https://www.googleapis.com/oauth2/v3/userinfo"); | ||
request.headers.set("Authorization", ["Bearer", accessToken].join(" ")); | ||
request.headers.set("Authorization", `Bearer ${accessToken}`); | ||
return await sendRequest(request); | ||
@@ -44,0 +44,0 @@ } |
@@ -46,3 +46,3 @@ import { TimeSpan, createDate } from "oslo"; | ||
headers: { | ||
Authorization: ["Bearer", accessToken].join(" ") | ||
Authorization: `Bearer ${accessToken}` | ||
} | ||
@@ -49,0 +49,0 @@ }); |
@@ -37,3 +37,3 @@ import { OAuth2Client } from "oslo/oauth2"; | ||
headers: { | ||
Authorization: ["Bearer", accessToken].join(" ") | ||
Authorization: `Bearer ${accessToken}` | ||
} | ||
@@ -40,0 +40,0 @@ }); |
@@ -43,3 +43,3 @@ import { TimeSpan, createDate } from "oslo"; | ||
headers: { | ||
Authorization: ["Bearer", accessToken].join(" ") | ||
Authorization: `Bearer ${accessToken}` | ||
} | ||
@@ -46,0 +46,0 @@ }); |
import type { OAuth2ProviderWithPKCE } from "../index.js"; | ||
export declare class Spotify implements OAuth2ProviderWithPKCE { | ||
private client; | ||
private clientSecret; | ||
private scope; | ||
constructor(clientId: string, redirectURI: string, options?: { | ||
constructor(clientId: string, clientSecret: string, redirectURI: string, options?: { | ||
scope?: string[]; | ||
}); | ||
createAuthorizationURL(codeVerifier: string): Promise<URL>; | ||
validateAuthorizationCode(code: string, codeVerifier: string): Promise<SpotifyTokens>; | ||
createAuthorizationURL(state: string): Promise<URL>; | ||
validateAuthorizationCode(code: string): Promise<SpotifyTokens>; | ||
getUser(accessToken: string): Promise<SpotifyUser>; | ||
@@ -11,0 +12,0 @@ refreshAccessToken(refreshToken: string): Promise<SpotifyTokens>; |
@@ -7,18 +7,20 @@ import { TimeSpan, createDate } from "oslo"; | ||
client; | ||
clientSecret; | ||
scope; | ||
constructor(clientId, redirectURI, options) { | ||
constructor(clientId, clientSecret, redirectURI, options) { | ||
this.client = new OAuth2Client(clientId, authorizeEndpoint, tokenEndpoint, { | ||
redirectURI | ||
}); | ||
this.clientSecret = clientSecret; | ||
this.scope = options?.scope ?? []; | ||
} | ||
async createAuthorizationURL(codeVerifier) { | ||
async createAuthorizationURL(state) { | ||
return await this.client.createAuthorizationURL({ | ||
codeVerifier, | ||
state, | ||
scope: this.scope | ||
}); | ||
} | ||
async validateAuthorizationCode(code, codeVerifier) { | ||
async validateAuthorizationCode(code) { | ||
const result = await this.client.validateAuthorizationCode(code, { | ||
codeVerifier | ||
credentials: this.clientSecret | ||
}); | ||
@@ -34,3 +36,3 @@ return { | ||
headers: { | ||
Authorization: ["Bearer", accessToken].join(" ") | ||
Authorization: `Bearer ${accessToken}` | ||
} | ||
@@ -37,0 +39,0 @@ }); |
@@ -36,3 +36,3 @@ import { TimeSpan, createDate } from "oslo"; | ||
headers: { | ||
Authorization: ["Bearer", accessToken].join(" ") | ||
Authorization: `Bearer ${accessToken}` | ||
} | ||
@@ -39,0 +39,0 @@ }); |
@@ -36,3 +36,3 @@ import { OAuth2Client, generateState } from "oslo/oauth2"; | ||
headers: { | ||
Authorization: ["Bearer", accessToken].join(" ") | ||
Authorization: `Bearer ${accessToken}` | ||
} | ||
@@ -39,0 +39,0 @@ }); |
{ | ||
"name": "arctic", | ||
"type": "module", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "OAuth 2.0 with built-in providers", | ||
@@ -27,3 +27,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"oslo": "0.23.3" | ||
"oslo": "0.23.5" | ||
}, | ||
@@ -30,0 +30,0 @@ "scripts": { |
@@ -19,4 +19,6 @@ # `arctic` | ||
- Github | ||
- GitLab | ||
- Spotify | ||
- Twitch | ||
@@ -30,3 +32,2 @@ | ||
- Microsoft Entra ID | ||
- Spotify | ||
@@ -130,3 +131,3 @@ | ||
const github = new GitHub(clientId, clientSecret, redirectURI); | ||
const google = new Google(clientId, clientSecret, redirectURI); | ||
``` | ||
@@ -133,0 +134,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49274
33
1222
218
11
+ Addedoslo@0.23.5(transitive)
- Removedoslo@0.23.3(transitive)
Updatedoslo@0.23.5