Skip to content

Instantly share code, notes, and snippets.

@mziwisky
mziwisky / Oauth2.md
Last active February 15, 2024 23:31
Oauth2 Explanation

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.

@nrk
nrk / redis_hash_copy.php
Created November 8, 2011 10:50
Use Redis scripting to copy an hash to a new key.
<?php
require 'autoload.php';
$redis = new Predis\Client('tcp://127.0.0.1', 'dev');
// *** NOTE *** Lua's unpack() has a limit on the size of the table imposed by
// the number of Lua stack slots that a C function can use. This value is defined
// by LUAI_MAXCSTACK in luaconf.h and for Redis is set to 8000, which translates
// to an hash of 4000 elements since HGETALL returns a list that interleaves field
@MrUzu
MrUzu / mobile-meta-html5.html
Created June 24, 2011 14:29
WebApp meta for Icons and Startup screens
<!-- HTML5 DOCTYPE, IMPORTANT -->
<!DOCTYPE html>
<html dir="ltr" lang="en-EN">
<head>
<meta charset="UTF-8" />
<title>Title</title>
<!-- VIEWPORT, AVOID BROWSER NAV BAR, AND HANDHELD DECLARATIONS -->