Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@crossid/vue-wrapper

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@crossid/vue-wrapper - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

4

package.json
{
"name": "@crossid/vue-wrapper",
"scope": "@crossid",
"version": "1.0.4",
"version": "1.0.5",
"description": "A wrapper for the crossid oauth2 client for vue3",

@@ -17,3 +17,3 @@ "main": "src/index.js",

"dependencies": {
"@crossid/crossid-spa-js": "^0.0.3",
"@crossid/crossid-spa-js": "^0.0.4",
"typescript": "^4.3.5",

@@ -20,0 +20,0 @@ "vue": "^3.0.0"

@@ -1,15 +0,12 @@

import { Client as CrossidClient } from "@crossid/crossid-spa-js";
import { Client as CrossidClient, } from "@crossid/crossid-spa-js";
import { defineComponent, h } from "vue";
export function create(options) {
const client = new CrossidClient(options);
const internalStore = {
user: null,
isAuthenticated: false,
};
const data = { internalStore, client };
const data = { client };
const authProvider = defineComponent({
render() {
return h("slot", null, this.$slots.default({
user: this.internalStore.user,
isAuthenticated: this.internalStore.isAuthenticated,
accessToken: this.accessToken,
user: this.user,
isAuthenticated: this.isAuthenticated,
loginRedirect: this.loginRedirect,

@@ -23,6 +20,2 @@ }));

}
else {
this.internalStore.isAuthenticated = !!user;
this.internalStore.user = user;
}
},

@@ -36,2 +29,12 @@ data() {

methods: {
async accessToken(opts) {
return client.getAccessToken(opts);
},
async user(opts) {
return client.getUser(opts);
},
async isAuthenticated(opts) {
const user = client.getUser(opts);
return !!user;
},
loginRedirect(audience, scope, returnTo) {

@@ -50,4 +53,5 @@ const options = {

return h("span", null, this.$slots.default({
user: this.internalStore.user,
isAuthenticated: this.internalStore.isAuthenticated,
accessToken: this.accessToken,
user: this.user,
isAuthenticated: this.isAuthenticated,
}));

@@ -62,2 +66,12 @@ },

methods: {
async accessToken(opts) {
return client.getAccessToken(opts);
},
async user(opts) {
return client.getUser(opts);
},
async isAuthenticated(opts) {
const user = client.getUser(opts);
return !!user;
},
async loginRedirectCallback() {

@@ -68,5 +82,2 @@ await this.client.handleRedirectCallback();

// const scope = sessionStorage.getItem('crossid.spa-js@scope')
const user = await client.getUser();
internalStore.user = user || null;
internalStore.isAuthenticated = !!user;
window.history.replaceState(null, null, returnTo);

@@ -73,0 +84,0 @@ this.$emit("navigate");

@@ -1,5 +0,10 @@

import { Client as CrossidClient, IDToken } from "@crossid/crossid-spa-js";
import {
Client as CrossidClient,
IDToken,
GetUserOpts,
GetAccessTokenOpts,
} from "@crossid/crossid-spa-js";
// todo replace with real opts once they are exported
type ClientOpts = any;
import { Component, defineComponent, h, onMounted } from "vue";
import { Component, defineComponent, h } from "vue";

@@ -9,2 +14,3 @@ interface IInternalStore {

user: IDToken | null;
loadState: string;
}

@@ -14,8 +20,4 @@

const client = new CrossidClient(options);
const internalStore: IInternalStore = {
user: null,
isAuthenticated: false,
};
const data = { internalStore, client };
const data = { client };

@@ -28,4 +30,5 @@ const authProvider = defineComponent({

this.$slots.default({
user: this.internalStore.user,
isAuthenticated: this.internalStore.isAuthenticated,
accessToken: this.accessToken,
user: this.user,
isAuthenticated: this.isAuthenticated,
loginRedirect: this.loginRedirect,

@@ -45,5 +48,2 @@ })

);
} else {
this.internalStore.isAuthenticated = !!user;
this.internalStore.user = user;
}

@@ -61,2 +61,15 @@ },

methods: {
async accessToken(opts?: GetAccessTokenOpts): Promise<string> {
return client.getAccessToken(opts);
},
async user(opts?: GetUserOpts): Promise<IDToken> {
return client.getUser(opts);
},
async isAuthenticated(opts?: GetUserOpts): Promise<boolean> {
const user = client.getUser(opts);
return !!user;
},
loginRedirect(audience: string, scope: string, returnTo: string) {

@@ -79,4 +92,5 @@ const options = {

this.$slots.default({
user: this.internalStore.user,
isAuthenticated: this.internalStore.isAuthenticated,
accessToken: this.accessToken,
user: this.user,
isAuthenticated: this.isAuthenticated,
})

@@ -94,2 +108,15 @@ );

methods: {
async accessToken(opts?: GetAccessTokenOpts): Promise<string> {
return client.getAccessToken(opts);
},
async user(opts?: GetUserOpts): Promise<IDToken> {
return client.getUser(opts);
},
async isAuthenticated(opts?: GetUserOpts): Promise<boolean> {
const user = client.getUser(opts);
return !!user;
},
async loginRedirectCallback() {

@@ -101,6 +128,2 @@ await this.client.handleRedirectCallback();

const user = await client.getUser();
internalStore.user = user || null;
internalStore.isAuthenticated = !!user;
window.history.replaceState(null, null, returnTo);

@@ -107,0 +130,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc