Skip to content

Instantly share code, notes, and snippets.

View spiritbroski's full-sized avatar
🍞
bismillah

ꦫꦶꦤꦺꦴ spiritbroski

🍞
bismillah
View GitHub Profile
yarn add @nuxtjs/dotenv
serverless deploy
"use strict";
const axios = require("axios");
const jwt = require("jsonwebtoken");
const formUrlEncoded = (x) =>
Object.keys(x).reduce((p, c) => p + `&${c}=${encodeURIComponent(x[c])}`, "");
const github = async function (params) {
const cloudant = require("@cloudant/cloudant")({
url: params.__bx_creds.cloudantnosqldb.url,
plugins: [
{ iamauth: { iamApiKey: params.__bx_creds.cloudantnosqldb.apikey } },
yarn add axios
yarn add -D serverless-dotenv-plugin serverless-openwhisk
github_client_id=<github client_id>
github_client_secret=<github client_secret>
token_pass=<token password for jwt token could be random>
frontend_url=<url of your static web hosting>
service: authorize
useDotenv: true
provider:
name: openwhisk
ignore_certs: true
functions:
authorize-github:
handler: authorize.github
parameters:
# you can find group name by running command `ibmcloud resource groups`
ibmcloud target -g <group name>
serverless create --template openwhisk-nodejs --path functions
cd functions
npm install -g serverless
ibmcloud target -r <region code>
ibmcloud target -o <org> -s <space>
ibmcloud wsk property get --auth