arctic
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -1,10 +0,10 @@ | ||
import type { OAuth2Provider } from "../index.js"; | ||
export declare class Roblox implements OAuth2Provider { | ||
import type { OAuth2ProviderWithPKCE } from "../index.js"; | ||
export declare class Roblox implements OAuth2ProviderWithPKCE { | ||
private client; | ||
private clientSecret; | ||
constructor(clientId: string, clientSecret: string, redirectURI: string); | ||
createAuthorizationURL(state: string, options?: { | ||
createAuthorizationURL(state: string, codeVerifier: string, options?: { | ||
scopes?: string[]; | ||
}): Promise<URL>; | ||
validateAuthorizationCode(code: string): Promise<RobloxTokens>; | ||
validateAuthorizationCode(code: string, codeVerifier: string): Promise<RobloxTokens>; | ||
refreshAccessToken(refreshToken: string): Promise<RobloxTokens>; | ||
@@ -11,0 +11,0 @@ } |
@@ -14,12 +14,15 @@ import { TimeSpan, createDate } from "oslo"; | ||
} | ||
async createAuthorizationURL(state, options) { | ||
async createAuthorizationURL(state, codeVerifier, options) { | ||
const scopes = options?.scopes ?? []; | ||
return await this.client.createAuthorizationURL({ | ||
state, | ||
codeVerifier, | ||
scopes: [...scopes, "openid"] | ||
}); | ||
} | ||
async validateAuthorizationCode(code) { | ||
async validateAuthorizationCode(code, codeVerifier) { | ||
const result = await this.client.validateAuthorizationCode(code, { | ||
credentials: this.clientSecret | ||
credentials: this.clientSecret, | ||
codeVerifier, | ||
authenticateWith: "request_body" // Roblox doesn't support HTTP basic auth | ||
}); | ||
@@ -26,0 +29,0 @@ const tokens = { |
{ | ||
"name": "arctic", | ||
"type": "module", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "OAuth 2.0 clients for popular providers", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
103816
2676