Skip to content

Instantly share code, notes, and snippets.

View gilbertmpanga12's full-sized avatar
💎
Crafting my stones

gilbert mpanga gilbertmpanga12

💎
Crafting my stones
View GitHub Profile
@gilbertmpanga12
gilbertmpanga12 / jwt-expiration.md
Created January 5, 2021 07:44 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

const admin = require("admin");
function getFirebaseUser(req, res, next) {
console.log("Check if request is authorized with Firebase ID token");
if (
!req.headers.authorization ||
!req.headers.authorization.startsWith("Bearer ")
) {
console.error(
"No Firebase ID token was passed as a Bearer token in the Authorization header.",
@gilbertmpanga12
gilbertmpanga12 / countries.json
Created August 20, 2020 11:22 — forked from rogargon/countries.json
List of countries as a JSON array of strings
["United States", "Canada", "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and/or Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British lndian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Cook Islands", "Costa Rica", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecudaor", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "F
@gilbertmpanga12
gilbertmpanga12 / Angular router Not loading some routes
Last active November 28, 2017 14:35
ISSUE WITH ANGULAR ROUTER. Gist is about a problem am facing with angular router, I used lazily loaded routes but when the app loads some of the links dont load as i randomly navigate . What could be the issue?
/*
In my main app.routing.ts
*/
import {Routes} from '@angular/router';
import {AdminLayoutComponent} from './layouts/admin/admin-layout.component';
import {AuthLayoutComponent} from './layouts/auth/auth-layout.component';
import {AuthGuard} from "./welcome/AuthGuard";
import {HelpComponent} from "./help/help.component";
import {HelpSidebarComponent} from "./help/help-sidebar/help-sidebar.component";
@gilbertmpanga12
gilbertmpanga12 / .md
Created November 22, 2017 07:11
Code issues

Keybase proof

I hereby claim:

  • I am gilbertmpanga12 on github.
  • I am gilbertmpanga12 (https://keybase.io/gilbertmpanga12) on keybase.
  • I have a public key ASBTjOjp9iP9p3335ynshjGleKFn9fCMjDZ1pnFIlwQaDwo

To claim this, I am signing this object: