How to use the universal-cookie.get function in universal-cookie

To help you get started, we’ve selected a few universal-cookie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Excel-MEC / ExcelPlay-2019 / src / config / auth0-samp.js View on Github external
constructor() {
    const csrftoken = cookieService.get('csrftoken');
    if (!csrftoken) {
      const loader = new ProgressiveLoader();
      loader.placeLoader('Auth_const');
      this.http
        .get(ApiRoot() + '/auth/v1/token', {
          withCredentials: true,
          observe: 'response',
        })
        .subscribe(res => {
          console.log(res);
          loader.removeLoader();
          // window.location.reload(true);
        });
    }
  }
github Excel-MEC / ExcelPlay-2019 / src / config / auth0-samp.js View on Github external
setSession = authResult => {
    // Set the time that the access token will expire at
    const expiresAt = JSON.stringify(
      authResult.expiresIn * 1000 + new Date().getTime(),
    );
    localStorage.setItem('access_token', authResult.accessToken);
    localStorage.setItem('id_token', authResult.idToken);
    localStorage.setItem('expires_at', expiresAt);
    const body = new FormData();
    const csrftoken = cookieService.get('csrftoken');
    // if (csrftoken) {
    body.append('access_token', authResult.accessToken);
    body.append('csrfmiddlewaretoken', csrftoken);
    // const loader = new ProgressiveLoader();
    // loader.placeLoader('Auth_ss');
    // return this.http
    //   .post(ApiRoot() + '/auth/v1/signin', body, { withCredentials: true })
    //   .pipe(
    //     map(res => {
    //       loader.removeLoader();
    //       // console.log(res.json());
    //       return res;
    //     }),
    //   );
    // }
  };

universal-cookie

Universal cookies for JavaScript

MIT
Latest version published 2 months ago

Package Health Score

85 / 100
Full package analysis