Skip to content

Instantly share code, notes, and snippets.

<!--
@description :
@author : Amit Singh
@group :
@last modified on : 02-02-2021
@last modified by : Amit Singh
Modifications Log
Ver Date Author Modification
1.0 02-02-2021 Amit Singh Initial Version
-->
<!--
@description :
@author : Amit Singh
@group :
@last modified on : 03-24-2021
@last modified by : Amit Singh
Modifications Log
Ver Date Author Modification
1.0 03-24-2021 Amit Singh Initial Version
-->
@tilakchandlo
tilakchandlo / react-auth0-spa.js
Created June 4, 2020 19:02 — forked from klequis/react-auth0-spa.js
Modification to Auth0Provider in react-auth0-spa.js
import React, { useState, useEffect, useContext } from 'react'
import createAuth0Client from '@auth0/auth0-spa-js'
const DEFAULT_REDIRECT_CALLBACK = () =>
window.history.replaceState({}, document.title, window.location.pathname)
export const Auth0Context = React.createContext()
export const useAuth0 = () => useContext(Auth0Context)
let _initOptions
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true,
"**/.tmp": true,
"**/.vscode": true,
"**/bower_components": true,
"**/node_modules": true,
abstract class AuthService {
// Subject tracks the current token, or is null if no token is currently
// available (e.g. refresh pending).
private subject = new BehaviorSubject<string|null>(null);
readonly refreshToken: Observable<any>;
readonly token: Observable<string>;
constructor() {
// refreshToken, when subscribed, gets the new token from the backend,
@tilakchandlo
tilakchandlo / http-auth-interceptor.ts
Created November 28, 2017 17:23 — forked from brettwold/http-auth-interceptor.ts
Angular2 Http Interceptor to be used with accessing authenticated APIs
import { Http, Request, RequestOptions, RequestOptionsArgs, Response, ConnectionBackend, Headers } from "@angular/http";
import { Observable } from "rxjs/Observable";
import "rxjs/add/observable/fromPromise";
import "rxjs/add/operator/mergeMap";
export interface InterceptorConfigOptional {
headerName?: string;
headerPrefix?: string;
noTokenError?: boolean;
}
@tilakchandlo
tilakchandlo / frontendDevlopmentBookmarks.md
Created May 16, 2017 15:51 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
@tilakchandlo
tilakchandlo / Full Stack JavaScript.md
Created November 11, 2016 19:03 — forked from royshouvik/Full Stack JavaScript.md
Learn Full Stack JavaScript Web Development for FREE using resources like YouTube, Udacity and NodeSchool