Socket
Socket
Sign inDemoInstall

arctic

Package Overview
Dependencies
37
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.0 to 0.10.0

2

dist/index.d.ts

@@ -55,3 +55,3 @@ export { Apple } from "./providers/apple.js";

export interface OAuth2ProviderWithPKCE {
createAuthorizationURL(codeVerifier: string): Promise<URL>;
createAuthorizationURL(state: string, codeVerifier: string): Promise<URL>;
validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;

@@ -58,0 +58,0 @@ refreshAccessToken?(refreshToken: string): Promise<Tokens>;

@@ -6,3 +6,3 @@ import type { OAuth2Provider } from "../index.js";

constructor(clientId: string, clientSecret: string, redirectURI: string);
createAuthorizationURL(codeVerifier: string, options?: {
createAuthorizationURL(state: string, options?: {
scopes?: string[];

@@ -9,0 +9,0 @@ }): Promise<URL>;

@@ -14,7 +14,7 @@ import { OAuth2Client } from "oslo/oauth2";

}
async createAuthorizationURL(codeVerifier, options) {
async createAuthorizationURL(state, options) {
const url = await this.client.createAuthorizationURL({
codeVerifier,
scopes: options?.scopes
});
url.searchParams.set("state", state);
url.searchParams.set("audience", "api.atlassian.com");

@@ -21,0 +21,0 @@ url.searchParams.set("prompt", "consent");

@@ -6,3 +6,3 @@ import type { OAuth2ProviderWithPKCE } from "../index.js";

constructor(clientId: string, clientSecret: string, redirectURI: string);
createAuthorizationURL(codeVerifier: string, options?: {
createAuthorizationURL(state: string, codeVerifier: string, options?: {
scopes?: string[];

@@ -9,0 +9,0 @@ }): Promise<URL>;

@@ -14,3 +14,3 @@ import { TimeSpan, createDate } from "oslo";

}
async createAuthorizationURL(codeVerifier, options) {
async createAuthorizationURL(state, codeVerifier, options) {
const scopes = options?.scopes ?? [];

@@ -21,2 +21,3 @@ const url = await this.client.createAuthorizationURL({

});
url.searchParams.set("state", state);
url.searchParams.set("nonce", "_");

@@ -23,0 +24,0 @@ return url;

@@ -7,3 +7,3 @@ import type { OAuth2ProviderWithPKCE } from "../index.js";

constructor(realmURL: string, clientId: string, clientSecret: string, redirectURI: string);
createAuthorizationURL(codeVerifier: string, options?: {
createAuthorizationURL(state: string, codeVerifier: string, options?: {
scopes?: string[];

@@ -10,0 +10,0 @@ }): Promise<URL>;

@@ -16,3 +16,3 @@ import { OAuth2Client } from "oslo/oauth2";

}
async createAuthorizationURL(codeVerifier, options) {
async createAuthorizationURL(state, codeVerifier, options) {
const scopes = options?.scopes ?? [];

@@ -23,2 +23,3 @@ const url = await this.client.createAuthorizationURL({

});
url.searchParams.set("state", state);
return url;

@@ -25,0 +26,0 @@ }

@@ -6,3 +6,3 @@ import type { OAuth2ProviderWithPKCE } from "../index.js";

constructor(clientId: string, clientSecret: string, redirectURI: string);
createAuthorizationURL(codeVerifier: string, options?: {
createAuthorizationURL(state: string, codeVerifier: string, options?: {
scopes?: string[];

@@ -9,0 +9,0 @@ }): Promise<URL>;

@@ -14,3 +14,3 @@ import { OAuth2Client, generateState } from "oslo/oauth2";

}
async createAuthorizationURL(codeVerifier, options) {
async createAuthorizationURL(state, codeVerifier, options) {
const scopes = options?.scopes ?? [];

@@ -21,3 +21,5 @@ const url = await this.client.createAuthorizationURL({

});
url.searchParams.set("state", generateState());
if (!state)
state = generateState();
url.searchParams.set("state", state);
return url;

@@ -24,0 +26,0 @@ }

@@ -6,3 +6,3 @@ import type { OAuth2ProviderWithPKCE } from "../index.js";

constructor(tenant: string, clientId: string, clientSecret: string, redirectURI: string);
createAuthorizationURL(codeVerifier: string, options?: {
createAuthorizationURL(state: string, codeVerifier: string, options?: {
scopes?: string[];

@@ -9,0 +9,0 @@ }): Promise<URL>;

@@ -14,3 +14,3 @@ import { TimeSpan, createDate } from "oslo";

}
async createAuthorizationURL(codeVerifier, options) {
async createAuthorizationURL(state, codeVerifier, options) {
const scopes = options?.scopes ?? [];

@@ -21,2 +21,3 @@ const url = await this.client.createAuthorizationURL({

});
url.searchParams.set("state", state);
url.searchParams.set("nonce", "_");

@@ -23,0 +24,0 @@ return url;

@@ -6,3 +6,3 @@ import type { OAuth2ProviderWithPKCE } from "../index.js";

constructor(clientId: string, clientSecret: string, redirectURI: string);
createAuthorizationURL(codeVerifier: string, options?: {
createAuthorizationURL(state: string, codeVerifier: string, options?: {
scopes?: string[];

@@ -9,0 +9,0 @@ }): Promise<URL>;

@@ -1,2 +0,2 @@

import { OAuth2Client, generateState } from "oslo/oauth2";
import { OAuth2Client } from "oslo/oauth2";
const authorizeEndpoint = "https://twitter.com/i/oauth2/authorize";

@@ -13,3 +13,3 @@ const tokenEndpoint = "https://api.twitter.com/2/oauth2/token";

}
async createAuthorizationURL(codeVerifier, options) {
async createAuthorizationURL(state, codeVerifier, options) {
const url = await this.client.createAuthorizationURL({

@@ -19,3 +19,3 @@ codeVerifier,

});
url.searchParams.set("state", generateState());
url.searchParams.set("state", state);
return url;

@@ -22,0 +22,0 @@ }

{
"name": "arctic",
"type": "module",
"version": "0.9.0",
"version": "0.10.0",
"description": "OAuth 2.0 with built-in providers",

@@ -6,0 +6,0 @@ "main": "dist/index.js",

# Arctic
Arctic is an OAuth 2.0 library for JavaScript/TypeScript that supports numerous providers. It's light weight, fully-typed, and runtime-agnostic. [Read the documentation →](./docs/main.md)
Arctic is an OAuth 2.0 library for JavaScript/TypeScript that supports numerous providers. It's light weight, fully-typed, and runtime-agnostic. [Read the documentation →](https://arctics.pages.dev)

@@ -5,0 +5,0 @@ ```ts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc