arctic
Advanced tools
Comparing version 0.3.1 to 0.3.2
export declare class Apple { | ||
private controller; | ||
private client; | ||
private scope; | ||
@@ -4,0 +4,0 @@ private credentials; |
import { TimeSpan, createDate } from "oslo"; | ||
import { decodeBase64 } from "oslo/encoding"; | ||
import { createJWT, parseJWT } from "oslo/jwt"; | ||
import { OAuth2Controller } from "oslo/oauth2"; | ||
import { OAuth2Client } from "oslo/oauth2"; | ||
const authorizeEndpoint = "https://appleid.apple.com/auth/authorize"; | ||
const tokenEndpoint = "https://appleid.apple.com/auth/token"; | ||
export class Apple { | ||
controller; | ||
client; | ||
scope; | ||
credentials; | ||
constructor(credentials, redirectURI, options) { | ||
this.controller = new OAuth2Controller(credentials.clientId, authorizeEndpoint, tokenEndpoint, { | ||
this.client = new OAuth2Client(credentials.clientId, authorizeEndpoint, tokenEndpoint, { | ||
redirectURI, | ||
@@ -20,3 +20,3 @@ responseMode: options?.responseMode | ||
async createAuthorizationURL(state) { | ||
return await this.controller.createAuthorizationURL({ | ||
return await this.client.createAuthorizationURL({ | ||
state, | ||
@@ -27,3 +27,3 @@ scope: this.scope | ||
async validateAuthorizationCode(code) { | ||
const result = await this.controller.validateAuthorizationCode(code, { | ||
const result = await this.client.validateAuthorizationCode(code, { | ||
authenticateWith: "request_body", | ||
@@ -41,3 +41,3 @@ credentials: await this.createClientSecret() | ||
async refreshAccessToken(refreshToken) { | ||
const result = await this.controller.refreshAccessToken(refreshToken, { | ||
const result = await this.client.refreshAccessToken(refreshToken, { | ||
authenticateWith: "request_body", | ||
@@ -44,0 +44,0 @@ credentials: await this.createClientSecret() |
export declare class AzureAD { | ||
private controller; | ||
private client; | ||
private scope; | ||
@@ -4,0 +4,0 @@ private clientSecret; |
import { TimeSpan, createDate } from "oslo"; | ||
import { parseJWT } from "oslo/jwt"; | ||
import { OAuth2Controller } from "oslo/oauth2"; | ||
import { OAuth2Client } from "oslo/oauth2"; | ||
export class AzureAD { | ||
controller; | ||
client; | ||
scope; | ||
@@ -11,3 +11,3 @@ clientSecret; | ||
const tokenEndpoint = `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/token`; | ||
this.controller = new OAuth2Controller(clientId, authorizeEndpoint, tokenEndpoint, { | ||
this.client = new OAuth2Client(clientId, authorizeEndpoint, tokenEndpoint, { | ||
redirectURI | ||
@@ -20,3 +20,3 @@ }); | ||
async createAuthorizationURL(state, codeVerifier) { | ||
const url = await this.controller.createAuthorizationURL({ | ||
const url = await this.client.createAuthorizationURL({ | ||
state, | ||
@@ -30,3 +30,3 @@ scope: this.scope, | ||
async validateAuthorizationCode(code, codeVerifier) { | ||
const result = await this.controller.validateAuthorizationCode(code, { | ||
const result = await this.client.validateAuthorizationCode(code, { | ||
authenticateWith: "request_body", | ||
@@ -53,3 +53,3 @@ credentials: this.clientSecret, | ||
async refreshAccessToken(refreshToken) { | ||
const result = await this.controller.refreshAccessToken(refreshToken, { | ||
const result = await this.client.refreshAccessToken(refreshToken, { | ||
authenticateWith: "request_body", | ||
@@ -56,0 +56,0 @@ credentials: this.clientSecret |
export declare class Discord { | ||
private controller; | ||
private client; | ||
private scope; | ||
@@ -4,0 +4,0 @@ private clientSecret; |
import { TimeSpan, createDate } from "oslo"; | ||
import { OAuth2Controller } from "oslo/oauth2"; | ||
import { OAuth2Client } from "oslo/oauth2"; | ||
const authorizeEndpoint = "https://discord.com/oauth2/authorize"; | ||
const tokenEndpoint = "https://discord.com/api/oauth2/token"; | ||
export class Discord { | ||
controller; | ||
client; | ||
scope; | ||
clientSecret; | ||
constructor(clientId, clientSecret, redirectURI, options) { | ||
this.controller = new OAuth2Controller(clientId, authorizeEndpoint, tokenEndpoint, { | ||
this.client = new OAuth2Client(clientId, authorizeEndpoint, tokenEndpoint, { | ||
redirectURI | ||
@@ -18,3 +18,3 @@ }); | ||
async createAuthorizationURL(state) { | ||
return await this.controller.createAuthorizationURL({ | ||
return await this.client.createAuthorizationURL({ | ||
state, | ||
@@ -25,3 +25,3 @@ scope: this.scope | ||
async validateAuthorizationCode(code) { | ||
const result = await this.controller.validateAuthorizationCode(code, { | ||
const result = await this.client.validateAuthorizationCode(code, { | ||
authenticateWith: "request_body", | ||
@@ -45,3 +45,3 @@ credentials: this.clientSecret | ||
async refreshAccessToken(refreshToken) { | ||
const result = await this.controller.refreshAccessToken(refreshToken, { | ||
const result = await this.client.refreshAccessToken(refreshToken, { | ||
authenticateWith: "request_body", | ||
@@ -48,0 +48,0 @@ credentials: this.clientSecret |
export declare class Facebook { | ||
private controller; | ||
private client; | ||
private scope; | ||
@@ -4,0 +4,0 @@ private clientSecret; |
import { TimeSpan, createDate } from "oslo"; | ||
import { OAuth2Controller } from "oslo/oauth2"; | ||
import { OAuth2Client } from "oslo/oauth2"; | ||
const authorizeEndpoint = "https://www.facebook.com/v16.0/dialog/oauth"; | ||
const tokenEndpoint = "https://graph.facebook.com/v16.0/oauth/access_token"; | ||
export class Facebook { | ||
controller; | ||
client; | ||
scope; | ||
clientSecret; | ||
constructor(clientId, clientSecret, redirectURI, options) { | ||
this.controller = new OAuth2Controller(clientId, authorizeEndpoint, tokenEndpoint, { | ||
this.client = new OAuth2Client(clientId, authorizeEndpoint, tokenEndpoint, { | ||
redirectURI | ||
@@ -18,3 +18,3 @@ }); | ||
async createAuthorizationURL(state) { | ||
return await this.controller.createAuthorizationURL({ | ||
return await this.client.createAuthorizationURL({ | ||
state, | ||
@@ -25,3 +25,3 @@ scope: this.scope | ||
async validateAuthorizationCode(code) { | ||
const result = await this.controller.validateAuthorizationCode(code, { | ||
const result = await this.client.validateAuthorizationCode(code, { | ||
authenticateWith: "request_body", | ||
@@ -28,0 +28,0 @@ credentials: this.clientSecret |
export declare class GitHub { | ||
private controller; | ||
private client; | ||
private scope; | ||
@@ -4,0 +4,0 @@ private clientSecret; |
@@ -1,10 +0,10 @@ | ||
import { OAuth2Controller } from "oslo/oauth2"; | ||
import { OAuth2Client } from "oslo/oauth2"; | ||
const authorizeEndpoint = "https://github.com/login/oauth/authorize"; | ||
const tokenEndpoint = "https://github.com/login/oauth/access_token"; | ||
export class GitHub { | ||
controller; | ||
client; | ||
scope; | ||
clientSecret; | ||
constructor(clientId, clientSecret, options) { | ||
this.controller = new OAuth2Controller(clientId, authorizeEndpoint, tokenEndpoint, { | ||
this.client = new OAuth2Client(clientId, authorizeEndpoint, tokenEndpoint, { | ||
redirectURI: options?.redirectURI | ||
@@ -16,3 +16,3 @@ }); | ||
async createAuthorizationURL(state) { | ||
return await this.controller.createAuthorizationURL({ | ||
return await this.client.createAuthorizationURL({ | ||
state, | ||
@@ -23,3 +23,3 @@ scope: this.scope | ||
async validateAuthorizationCode(code) { | ||
const result = await this.controller.validateAuthorizationCode(code, { | ||
const result = await this.client.validateAuthorizationCode(code, { | ||
authenticateWith: "request_body", | ||
@@ -26,0 +26,0 @@ credentials: this.clientSecret |
export declare class Google { | ||
private controller; | ||
private client; | ||
private scope; | ||
@@ -4,0 +4,0 @@ private clientSecret; |
import { TimeSpan, createDate } from "oslo"; | ||
import { OAuth2Controller } from "oslo/oauth2"; | ||
import { OAuth2Client } from "oslo/oauth2"; | ||
import { sendRequest } from "../request.js"; | ||
@@ -7,3 +7,3 @@ const authorizeEndpoint = "https://accounts.google.com/o/oauth2/v2/auth"; | ||
export class Google { | ||
controller; | ||
client; | ||
scope; | ||
@@ -13,3 +13,3 @@ clientSecret; | ||
constructor(clientId, clientSecret, redirectURI, options) { | ||
this.controller = new OAuth2Controller(clientId, authorizeEndpoint, tokenEndpoint, { | ||
this.client = new OAuth2Client(clientId, authorizeEndpoint, tokenEndpoint, { | ||
redirectURI | ||
@@ -23,3 +23,3 @@ }); | ||
async createAuthorizationURL(state) { | ||
const url = await this.controller.createAuthorizationURL({ | ||
const url = await this.client.createAuthorizationURL({ | ||
state, | ||
@@ -32,3 +32,3 @@ scope: this.scope | ||
async validateAuthorizationCode(code) { | ||
const result = await this.controller.validateAuthorizationCode(code, { | ||
const result = await this.client.validateAuthorizationCode(code, { | ||
authenticateWith: "request_body", | ||
@@ -49,3 +49,3 @@ credentials: this.clientSecret | ||
async refreshAccessToken(refreshToken) { | ||
const result = await this.controller.refreshAccessToken(refreshToken, { | ||
const result = await this.client.refreshAccessToken(refreshToken, { | ||
authenticateWith: "request_body", | ||
@@ -52,0 +52,0 @@ credentials: this.clientSecret |
export declare class Line { | ||
private controller; | ||
private client; | ||
private scope; | ||
@@ -4,0 +4,0 @@ private clientSecret; |
import { TimeSpan, createDate } from "oslo"; | ||
import { parseJWT } from "oslo/jwt"; | ||
import { OAuth2Controller } from "oslo/oauth2"; | ||
import { OAuth2Client } from "oslo/oauth2"; | ||
const authorizeEndpoint = "https://access.line.me/oauth2/v2.1/authorize"; | ||
const tokenEndpoint = "https://api.line.me/oauth2/v2.1/token"; | ||
export class Line { | ||
controller; | ||
client; | ||
scope; | ||
clientSecret; | ||
constructor(clientId, clientSecret, redirectURI, options) { | ||
this.controller = new OAuth2Controller(clientId, authorizeEndpoint, tokenEndpoint, { | ||
this.client = new OAuth2Client(clientId, authorizeEndpoint, tokenEndpoint, { | ||
redirectURI | ||
@@ -19,3 +19,3 @@ }); | ||
async createAuthorizationURL(state) { | ||
return await this.controller.createAuthorizationURL({ | ||
return await this.client.createAuthorizationURL({ | ||
state, | ||
@@ -26,3 +26,3 @@ scope: this.scope | ||
async validateAuthorizationCode(code) { | ||
const result = await this.controller.validateAuthorizationCode(code, { | ||
const result = await this.client.validateAuthorizationCode(code, { | ||
authenticateWith: "request_body", | ||
@@ -52,3 +52,3 @@ credentials: this.clientSecret | ||
async refreshAccessToken(refreshToken) { | ||
const result = await this.controller.refreshAccessToken(refreshToken, { | ||
const result = await this.client.refreshAccessToken(refreshToken, { | ||
authenticateWith: "request_body", | ||
@@ -55,0 +55,0 @@ credentials: this.clientSecret |
export declare class Spotify { | ||
private controller; | ||
private client; | ||
private scope; | ||
@@ -4,0 +4,0 @@ private clientSecret; |
import { TimeSpan, createDate } from "oslo"; | ||
import { OAuth2Controller } from "oslo/oauth2"; | ||
import { OAuth2Client } from "oslo/oauth2"; | ||
const authorizeEndpoint = "https://accounts.spotify.com/authorize"; | ||
const tokenEndpoint = "https://accounts.spotify.com/api/token"; | ||
export class Spotify { | ||
controller; | ||
client; | ||
scope; | ||
clientSecret; | ||
constructor(clientId, clientSecret, redirectURI, options) { | ||
this.controller = new OAuth2Controller(clientId, authorizeEndpoint, tokenEndpoint, { | ||
this.client = new OAuth2Client(clientId, authorizeEndpoint, tokenEndpoint, { | ||
redirectURI | ||
@@ -17,3 +17,3 @@ }); | ||
async createAuthorizationURL(state) { | ||
return await this.controller.createAuthorizationURL({ | ||
return await this.client.createAuthorizationURL({ | ||
state, | ||
@@ -24,3 +24,3 @@ scope: this.scope | ||
async validateAuthorizationCode(code) { | ||
const result = await this.controller.validateAuthorizationCode(code, { | ||
const result = await this.client.validateAuthorizationCode(code, { | ||
credentials: this.clientSecret | ||
@@ -43,3 +43,3 @@ }); | ||
async refreshAccessToken(refreshToken) { | ||
const result = await this.controller.refreshAccessToken(refreshToken); | ||
const result = await this.client.refreshAccessToken(refreshToken); | ||
return { | ||
@@ -46,0 +46,0 @@ accessToken: result.access_token, |
export declare class Twitch { | ||
private controller; | ||
private client; | ||
private scope; | ||
@@ -4,0 +4,0 @@ private clientSecret; |
import { TimeSpan, createDate } from "oslo"; | ||
import { OAuth2Controller } from "oslo/oauth2"; | ||
import { OAuth2Client } from "oslo/oauth2"; | ||
const authorizeEndpoint = "https://id.twitch.tv/oauth2/authorize"; | ||
const tokenEndpoint = "https://id.twitch.tv/oauth2/token"; | ||
export class Twitch { | ||
controller; | ||
client; | ||
scope; | ||
clientSecret; | ||
constructor(clientId, clientSecret, redirectURI, options) { | ||
this.controller = new OAuth2Controller(clientId, authorizeEndpoint, tokenEndpoint, { | ||
this.client = new OAuth2Client(clientId, authorizeEndpoint, tokenEndpoint, { | ||
redirectURI | ||
@@ -17,3 +17,3 @@ }); | ||
async createAuthorizationURL(state) { | ||
return await this.controller.createAuthorizationURL({ | ||
return await this.client.createAuthorizationURL({ | ||
state, | ||
@@ -24,3 +24,3 @@ scope: this.scope | ||
async validateAuthorizationCode(code) { | ||
const result = await this.controller.validateAuthorizationCode(code, { | ||
const result = await this.client.validateAuthorizationCode(code, { | ||
authenticateWith: "request_body", | ||
@@ -44,3 +44,3 @@ credentials: this.clientSecret | ||
async refreshAccessToken(refreshToken) { | ||
const result = await this.controller.refreshAccessToken(refreshToken, { | ||
const result = await this.client.refreshAccessToken(refreshToken, { | ||
authenticateWith: "request_body", | ||
@@ -47,0 +47,0 @@ credentials: this.clientSecret |
export declare class Twitter { | ||
private controller; | ||
private client; | ||
private scope; | ||
@@ -4,0 +4,0 @@ private clientSecret; |
@@ -1,10 +0,10 @@ | ||
import { OAuth2Controller } from "oslo/oauth2"; | ||
import { OAuth2Client } from "oslo/oauth2"; | ||
const authorizeEndpoint = "https://twitter.com/i/oauth2/authorize"; | ||
const tokenEndpoint = "https://api.twitter.com/2/oauth2/token"; | ||
export class Twitter { | ||
controller; | ||
client; | ||
scope; | ||
clientSecret; | ||
constructor(clientId, clientSecret, redirectURI, options) { | ||
this.controller = new OAuth2Controller(clientId, authorizeEndpoint, tokenEndpoint, { | ||
this.client = new OAuth2Client(clientId, authorizeEndpoint, tokenEndpoint, { | ||
redirectURI | ||
@@ -17,3 +17,3 @@ }); | ||
async createAuthorizationURL(state, codeVerifier) { | ||
return await this.controller.createAuthorizationURL({ | ||
return await this.client.createAuthorizationURL({ | ||
state, | ||
@@ -25,3 +25,3 @@ scope: this.scope, | ||
async validateAuthorizationCode(code, codeVerifier) { | ||
const result = await this.controller.validateAuthorizationCode(code, { | ||
const result = await this.client.validateAuthorizationCode(code, { | ||
credentials: this.clientSecret, | ||
@@ -44,3 +44,3 @@ codeVerifier | ||
async refreshAccessToken(refreshToken) { | ||
const result = await this.controller.refreshAccessToken(refreshToken, { | ||
const result = await this.client.refreshAccessToken(refreshToken, { | ||
authenticateWith: "request_body", | ||
@@ -47,0 +47,0 @@ credentials: this.clientSecret |
{ | ||
"name": "arctic", | ||
"type": "module", | ||
"version": "0.3.1", | ||
"description": "A collection of auth-related utilities", | ||
"version": "0.3.2", | ||
"description": "OAuth 2.0 with built-in providers", | ||
"main": "dist/index.js", | ||
@@ -16,3 +16,3 @@ "types": "dist/index.d.ts", | ||
"type": "git", | ||
"url": "https://github.com/pilcrowOnPaper/oslo" | ||
"url": "https://github.com/pilcrowOnPaper/arctic" | ||
}, | ||
@@ -28,3 +28,3 @@ "devDependencies": { | ||
"dependencies": { | ||
"oslo": "0.21.0" | ||
"oslo": "0.23.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "scripts": { |
41454
+ Addedoslo@0.23.0(transitive)
- Removedoslo@0.21.0(transitive)
Updatedoslo@0.23.0