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

cordova-spotify-oauth

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-spotify-oauth - npm Package Compare versions

Comparing version 0.1.10 to 0.1.11

25

oauth-token-api/spotifyTokenService.js

@@ -17,2 +17,15 @@ 'use strict';

// add CORS headers to response
// Reference: https://serverless.com/blog/cors-api-gateway-survival-guide/#cors-response-headers
function cors(response) {
if (response) {
const headers = response.headers || {};
headers["Access-Control-Allow-Origin"] = "*"; // Required for CORS support to work
headers["Access-Control-Allow-Credentials"] = true; // Required for cookies, authorization headers with HTTPS
response.headers = headers;
}
return response;
}
const spotifyRequest = params => {

@@ -51,3 +64,3 @@ return new Promise((resolve, reject) => {

if (!params.code) {
callback(null, {
callback(null, cors({
statusCode: 400,

@@ -57,3 +70,3 @@ body: JSON.stringify({

})
});
}));
return;

@@ -81,3 +94,3 @@ }

.then(response => {
callback(null, response);
callback(null, cors(response));
});

@@ -90,3 +103,3 @@ };

if (!params.refresh_token) {
callback(null, {
callback(null, cors({
statusCode: 400,

@@ -96,3 +109,3 @@ body: JSON.stringify({

})
});
}));
return;

@@ -118,4 +131,4 @@ }

.then(response => {
callback(null, response);
callback(null, cors(response));
});
};
{
"name": "cordova-spotify-oauth",
"version": "0.1.10",
"version": "0.1.11",
"description": "Cordova plugin for authenticating with Spotify",

@@ -5,0 +5,0 @@ "main": "www/build/spotify-oauth.min.js",

@@ -66,3 +66,3 @@ # Cordova Spotify OAuth Plugin

The authorization code flow requires server code for security. These come in the form of two HTTP endpoints, one for the auth code exchange, and the other one for access token refresh. The SDK will POST `application/x-www-form-urlencoded` data and expects JSON back.
The authorization code flow requires server code for security. These come in the form of two HTTP endpoints, one for the auth code exchange, and the other one for access token refresh. The SDK will POST `application/x-www-form-urlencoded` data and expects JSON back. Ensure you have proper CORS config set up.

@@ -69,0 +69,0 @@ To easily implement them, we built a [Serverless][serverless] service for [AWS Lambda][aws-lambda] over in the [`oauth-token-api`][token-api-example] folder. Make sure you [install the Serverless Framework properly][serverless-installation]!

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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