Skip to content

Instantly share code, notes, and snippets.

View woloski's full-sized avatar

Matias Woloski woloski

View GitHub Profile

DRY

Labor specialization helped spur the Industrial Revolution and the technology-driven world in which we live. I firmly believe that startups are the equivalent of this century, providing the the building blocks for today's apps:

  • Sendgrid spent years thinking about e-mail delivery.
  • Stripe has been processing payments for 4 years.
  • Twilio has cracked all the details of guarranted SMS delivery across the world.
  • Auth0 has experts on the subject that went through every detail of authentication, authorization and user management.
  • ... and so on
@woloski
woloski / token.txt
Last active August 29, 2015 14:14
hiring
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ3aGF0IjoiYmFja2VuZCAmIGZyb250ZW5kIGVuZ2luZWVycyIsIndoZXJlIjoiYW55d2hlcmUuIEFyZ2VudGluYSBvciBTZWF0dGxlIHByZWZlcnJlZCIsImhvdyI6ImVtYWlsIHRvIGpvYnNAYXV0aDAuY29tIiwiaW5jbHVkZSI6eyJ3aG8iOiJPbmUgcGFyYWdyYXBoIGV4cGxhaW5pbmcgd2hvIHlvdSBhcmUiLCJsaW5rcyI6WyJHaXRIdWIiLCJUd2l0dGVyIiwiTGlua2VkSW4iXSwiY29kZSI6IkEgcGllY2Ugb2YgYGNvZGVgIHRoYXQgeW91IGxpa2UgKG5vdCBuZWNlc3NhcmlseSB5b3VycykifSwiYWJvdXRfYXV0aDAiOlsiYXV0aDAuY29tL2pvYnMiLCJhdXRoMC5jb20vb3NzIiwiYXV0aDAuY29tL2Fib3V0IiwiZ2l0aHViLmNvbS9hdXRoMCJdfQ._PHycTzoLHmjn6ejZKg7kgvfPzNSINI04q8prqxojJg
┌──────────────────┐ ┌──────────────────┐
│ │ webtask token │ │
│ Website │◀──(w/id_token)────▶│ Auth0 │
│ │ │ │
└──────────────────┘ └──────────────────┘
@woloski
woloski / top.md
Created May 16, 2015 23:18
top 100 packages from heroku distiled for webtask
  • bcrypt: A bcrypt library for NodeJS.
  • pg: PostgreSQL client - pure javascript & libpq with the same API
  • q: A library for promises (CommonJS/Promises/A,B,D)
  • node-uuid: Rigorous implementation of RFC4122 (v1 and v4) UUIDs.
  • optimist: Light-weight option parsing with an argv hash. No optstrings attached.
  • aws-sdk: AWS SDK for JavaScript
  • validator: String validation and sanitization
  • cheerio: Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • knox: Amazon S3 client
  • consolidate: Template engine consolidation library
@woloski
woloski / webtask-auth0.md
Last active September 13, 2016 11:00
webtask + auth0
wt create webtask.js --auth0

When browsing the webtask URL, the user will get a page with Lock. Once logged in, the result of the webtask will be shown.

@woloski
woloski / runscope vs node.md
Last active October 3, 2015 22:48
Runscope vs Node+Mocha

This is a comparison of two testing approaches: Runscope service and pure Node.js coding. Written by Hernan Meydac Jean (@VerlicRedclaw)

Runscope

This service provides a simple to use editor to create API tests with no effort.

Pros

  • Nice postman-like editor to create API tests.
  • Lots of configurable options, initial variables, shared settings, conditionals, etc.
  • Uses Chai.js as the Assertion library for responses
@woloski
woloski / payment.html
Last active October 1, 2020 15:46
Stripe Checkout + webtask
<button class="pay">Pay</button>
<script src="https://checkout.stripe.com/checkout.js">
<script>
var handler = StripeCheckout.configure({
key: window.STRIPE_PUBLICK_KEY,
image: 'https://yourlogo.png',
locale: 'auto',
token: function(token) {
$('.pay').prop("disabled", true);
@woloski
woloski / slack-auth0.md
Last active August 7, 2019 15:16
Slack + Auth0
  1. Install the Custom Social Connections extension
  2. Click on the Slack button to install the Slack connection
  3. Enter a Slack Client ID and Secret. To get those go to: https://api.slack.com/apps/new. Fill the fields and pay special attention to the Redirect URI. Enter: https://YOURS.auth0.com/login/callback. See screenshots below.
  4. Click on App Credentials on the left and copy the Client ID and Client Secret and paste them on the Auth0 dashboard
  5. Click Save and then try the flow using the Try button. You should get back the full profile from Slack, including email, team and avatars.

Note: you can change the scopes on the Scope field on Auth0 and include any of these: https://api.slack.com/docs/oauth-scopes

You can now use the Slack connection using any Auth0 client library. Example:

@woloski
woloski / readme.md
Created August 29, 2016 18:16
functions registry

Public Functions

I will create a hello world function:

echo "module.exports = function(ctx, cb) { cb(null, 'hello'); }" > hello.js
wt create hello.js
@woloski
woloski / clientcreds.md
Last active September 1, 2016 18:54
Client Credentials Rules in Auth0

This is preliminary feature to add rules into the Client Credentials exchange pipeline (i.e. exchange a client_id and secret for an access_token).

To create a rule that runs on the client credentials exchange you have to use the webtask CLI (wt). To install the CLI, you can follow the steps here: https://manage.auth0.com/#/account/webtasks.

Assuming you have an API defined with scopes (https://manage.auth0.com/#/apis) and you created a non-interactive client (https://manage.auth0.com/#/applications) and authorized it to use that API, follow these steps to create a rule.

Currenlt you can create only one rule that will be executed for all clients and APIs.

  1. The first step is to create the webtask rule. Create a file myrule.js and enter the following. This is an example rule that will add an arbitrary claim (https://foo.com/claim) to the access_token and will also add an extra scope to the default scopes configured on the API (https://