Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remix-auth-oauth2

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remix-auth-oauth2 - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

42

build/index.js

@@ -93,8 +93,9 @@ "use strict";

debug("State from URL", stateUrl);
if (!stateUrl)
throw (0, server_runtime_1.json)({ message: "Missing state on URL." }, { status: 400 });
if (!stateUrl) {
return await this.failure("Missing state on URL.", request, sessionStorage, options, new Error("Missing state on URL."));
}
let stateSession = session.get(this.sessionStateKey);
debug("State from session", stateSession);
if (!stateSession) {
throw (0, server_runtime_1.json)({ message: "Missing state on session." }, { status: 400 });
return await this.failure("Missing state on session.", request, sessionStorage, options, new Error("Missing state on session."));
}

@@ -105,16 +106,18 @@ if (stateSession === stateUrl) {

}
else
throw (0, server_runtime_1.json)({ message: "State doesn't match." }, { status: 400 });
else {
return await this.failure("State doesn't match.", request, sessionStorage, options, new Error("State doesn't match."));
}
let code = url.searchParams.get("code");
if (!code)
throw (0, server_runtime_1.json)({ message: "Missing code." }, { status: 400 });
// Get the access token
let params = new URLSearchParams(this.tokenParams());
params.set("grant_type", "authorization_code");
params.set("redirect_uri", callbackURL.toString());
let { accessToken, refreshToken, extraParams } = await this.fetchAccessToken(code, params);
// Get the profile
let profile = await this.userProfile(accessToken, extraParams);
// Verify the user and return it, or redirect
if (!code) {
return await this.failure("Missing code.", request, sessionStorage, options, new Error("Missing code."));
}
try {
// Get the access token
let params = new URLSearchParams(this.tokenParams());
params.set("grant_type", "authorization_code");
params.set("redirect_uri", callbackURL.toString());
let { accessToken, refreshToken, extraParams } = await this.fetchAccessToken(code, params);
// Get the profile
let profile = await this.userProfile(accessToken, extraParams);
// Verify the user and return it, or redirect
user = await this.verify({

@@ -229,9 +232,4 @@ accessToken,

if (!response.ok) {
try {
let body = await response.text();
throw new Response(body, { status: 401 });
}
catch (error) {
throw new Response(error.message, { status: 401 });
}
let body = await response.text();
throw body;
}

@@ -238,0 +236,0 @@ return await this.getAccessToken(response.clone());

{
"name": "remix-auth-oauth2",
"version": "1.4.0",
"version": "1.5.0",
"main": "./build/index.js",

@@ -5,0 +5,0 @@ "types": "./build/index.d.ts",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc