Skip to content

Instantly share code, notes, and snippets.

@ahallora
ahallora / keybase.md
Created March 4, 2015 05:41
keybase.md

Keybase proof

I hereby claim:

  • I am ahallora on github.
  • I am aholm (https://keybase.io/aholm) on keybase.
  • I have a public key whose fingerprint is F66A D56D 665E 27CA 607B D762 FECA 5321 AC4F C509

To claim this, I am signing this object:

@ahallora
ahallora / server.js
Last active November 18, 2015 09:43
Spotify Token Exchange (written in node.js)
// Node.js version of the Spotify Token Exchange originally scripted in ruby (based on beta 6 release candidate)
// https://github.com/spotify/ios-sdk/blob/master/Demo%20Projects/spotify_token_swap.rb
var express = require('express');
var bodyParser = require('body-parser');
var request = require('request');
var app = express();
var http = require('http').Server(app);
var config = {}
@ahallora
ahallora / getSpotifyAccessToken
Last active March 17, 2023 09:44
Get Spotify Access Token (client credentials) with PHP and cURL
<?php
$client_id = '<insert your spotify app client id>';
$client_secret = '<insert your spotify app client secret>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://accounts.spotify.com/api/token' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, 'grant_type=client_credentials' );