Code Monkey home page Code Monkey logo

angular-sdk's Introduction

Descope SDK for Angular

The Descope SDK for Angular provides convenient access to the Descope for an application written on top of Angular. You can read more on the Descope Website.

Requirements

Installing the SDK

Install the package with:

npm i --save @descope/angular-sdk

Add Descope type definitions to your tsconfig.ts

  "compilerOptions": {
    "typeRoots": ["./node_modules/@descope"],
    <other options>
  }

Usage

NgModule - Import DescopeAuthModule to your application

app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';
import { DescopeAuthModule } from '@descope/angular-sdk';

@NgModule({
	declarations: [AppComponent],
	imports: [
		BrowserModule,
		DescopeAuthModule.forRoot({
			projectId: '<your_project_id>'
		})
	],
	bootstrap: [AppComponent]
})
export class AppModule {}

Standalone Mode - Configure Descope SDK for your application

main.ts

import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { DescopeAuthConfig } from '@descope/angular-sdk';

bootstrapApplication(AppComponent, {
	providers: [
		{ provide: DescopeAuthConfig, useValue: { projectId: '<your_project_id>' } }
	]
}).catch((err) => console.error(err));

Use Descope to render specific flow

You can use default flows or provide flow id directly to the descope component

1. Default flows

app.component.html

<descope-sign-in-flow
        (success)="onSuccess($event)"
        (error)="onError($event)"
        (ready)="onReady()"
></descope-sign-in-flow>
<!-- Optionally, you can show/hide loading indication until the flow page is ready -->
<div
  *ngIf="isLoading"
  class="loading-indicator"
  style="display: flex; justify-content: center; align-items: center;"
>
  Loading...
</div>

app.component.ts

import { Component } from '@angular/core';

@Component({
	selector: 'app-root',
	templateUrl: './app.component.html'
})
export class AppComponent {
	// Optionally, you can show/hide loading indication until the flow page is ready
	// See usage in onReady() method and the html template
	isLoading = true;

	onSuccess(e: CustomEvent) {
		console.log('SUCCESSFULLY LOGGED IN', e.detail);
	}

	onError(e: CustomEvent) {
		console.log('ERROR FROM LOG IN FLOW', e.detail);
	}

	onReady() {
		this.isLoading = false;
	}
}

2. Provide flow id

<descope
     flowId="<your_flow_id>"
     (success)="<your_success_function>"
     (error)="<your_error_function>"
<!-- theme can be "light", "dark" or "os", which auto select a theme based on the OS theme. Default is "light"
     theme="dark"

     locale can be any supported locale which the flow's screen translated to, if not provided, the locale is taken from the browser's locale.
     locale="en"

     debug can be set to true to enable debug mode
     debug="true"

     tenant ID for SSO (SAML) login. If not provided, Descope will use the domain of available email to choose the tenant
     tenant=<tenantId>

     Redirect URL for OAuth and SSO (will be used when redirecting back from the OAuth provider / IdP), or for "Magic Link" and "Enchanted Link" (will be used as a link in the message sent to the the user)
     redirectUrl=<redirectUrl>

     telemetryKey=<telemtry_key>

     autoFocus can be true, false or "skipFirstScreen". Default is true.
     - true: automatically focus on the first input of each screen
     - false: do not automatically focus on screen's inputs
     - "skipFirstScreen": automatically focus on the first input of each screen, except first screen
     autoFocus="skipFirstScreen"

     errorTransformer is a function that receives an error object and returns a string. The returned string will be displayed to the user.
     NOTE: errorTransformer is not required. If not provided, the error object will be displayed as is.
     Example:
     errorTransformer = (error: { text: string; type: string }): string => {
         const translationMap: { [key: string]: string } = {
             SAMLStartFailed: 'Failed to start SAML flow'
         };
         return translationMap[error.type] || error.text;
     };
     ...
     errorTransformer={errorTransformer}

    form is an object the initial form context that is used in screens inputs in the flow execution.
    Used to inject predefined input values on flow start such as custom inputs, custom attributes and other inputs.
    Keys passed can be accessed in flows actions, conditions and screens prefixed with "form.".
    NOTE: form is not required. If not provided, 'form' context key will be empty before user input.
    Example:
    form={{ email: "[email protected]",  firstName: "test", "customAttribute.test": "aaaa", "myCustomInput": 12 }}

    client is an object the initial client context in the flow execution.
    Keys passed can be accessed in flows actions and conditions prefixed with "client.".
    NOTE: client is not required. If not provided, context key will be empty.
    Example:
    client={{ version: "1.2.0" }}

     logger is an object describing how to log info, warn and errors.
     NOTE: logger is not required. If not provided, the logs will be printed to the console.
     Example:
     const logger = {
     	info: (title: string, description: string, state: any) => {
          console.log(title, description, JSON.stringify(state));
      },
     	warn: (title: string, description: string) => {
          console.warn(title);
      },
     	error: (title: string, description: string) => {
          console.error('OH NOO');
      },
     }
     ...
     logger={logger}-->
></descope>

Standalone Mode

All components in the sdk are standalone, so you can use them by directly importing them to your components.

Use the DescopeAuthService and its exposed fields (descopeSdk, session$, user$) to access authentication state, user details and utilities

This can be helpful to implement application-specific logic. Examples:

  • Render different components if current session is authenticated
  • Render user's content
  • Logout button

app.component.html

<p *ngIf="!isAuthenticated"> You are not logged in</p>
<button *ngIf="isAuthenticated" (click)="logout()">LOGOUT</button>
<p>User: {{userName}}</p>

app.component.ts

import { Component, OnInit } from '@angular/core';
import { DescopeAuthService } from '@descope/angular-sdk';

@Component({
	selector: 'app-home',
	templateUrl: './app.component.html',
	styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
	isAuthenticated: boolean = false;
	userName: string = '';

	constructor(private authService: DescopeAuthService) {}

	ngOnInit() {
		this.authService.session$.subscribe((session) => {
			this.isAuthenticated = session.isAuthenticated;
		});
		this.authService.user$.subscribe((descopeUser) => {
			if (descopeUser.user) {
				this.userName = descopeUser.user.name ?? '';
			}
		});
	}

	logout() {
		this.authService.descopeSdk.logout();
	}
}

Session Refresh

DescopeAuthService provides refreshSession and refreshUser methods that triggers a single request to the Descope backend to attempt to refresh the session or user. You can use them whenever you want to refresh the session/user. For example you can use APP_INITIALIZER provider to attempt to refresh session and user on each page refresh:

app.module.ts

import { APP_INITIALIZER, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { DescopeAuthModule, DescopeAuthService } from '@descope/angular-sdk';
import { zip } from 'rxjs';

export function initializeApp(authService: DescopeAuthService) {
	return () => zip([authService.refreshSession(), authService.refreshUser()]);
}

@NgModule({
	declarations: [AppComponent],
	imports: [
		BrowserModule,
		DescopeAuthModule.forRoot({
			projectId: '<your_project_id>'
		})
	],
	providers: [
		{
			provide: APP_INITIALIZER,
			useFactory: initializeApp,
			deps: [DescopeAuthService],
			multi: true
		}
	],
	bootstrap: [AppComponent]
})
export class AppModule {}

Standalone Mode Note:

You can use the same approach with APP_INITIALIZER in standalone mode, by adding it to providers array of the application.

Descope Interceptor

You can also use DescopeInterceptor to attempt to refresh session on each HTTP request that gets 401 or 403 response:

app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import {
	HttpClientModule,
	provideHttpClient,
	withInterceptors
} from '@angular/common/http';
import { DescopeAuthModule, descopeInterceptor } from '@descope/angular-sdk';

@NgModule({
	declarations: [AppComponent],
	imports: [
		BrowserModule,
		HttpClientModule,
		DescopeAuthModule.forRoot({
			projectId: '<your_project_id>',
			pathsToIntercept: ['/protectedPath']
		})
	],
	providers: [provideHttpClient(withInterceptors([descopeInterceptor]))],
	bootstrap: [AppComponent]
})
export class AppModule {}

DescopeInterceptor:

  • is configured for requests that urls contain one of pathsToIntercept. If not provided it will be used for all requests.
  • attaches session token as Authorization header in Bearer <token> format
  • if requests get response with 401 or 403 it automatically attempts to refresh session
  • if refresh attempt is successful, it automatically retries original request, otherwise it fails with original error

For more SDK usage examples refer to docs

Session token server validation (pass session token to server API)

When developing a full-stack application, it is common to have private server API which requires a valid session token:

session-token-validation-diagram

Note: Descope also provides server-side SDKs in various languages (NodeJS, Go, Python, etc). Descope's server SDKs have out-of-the-box session validation API that supports the options described bellow. To read more about session validation, Read this section in Descope documentation.

You can securely communicate with your backend either by using DescopeInterceptor or manually adding token to your requests (ie. by using DescopeAuthService.getSessionToken() helper function)

Helper Functions

You can also use the following helper methods on DescopeAuthService to assist with various actions managing your JWT.

  • getSessionToken() - Get current session token.
  • getRefreshToken() - Get current refresh token.
  • isAuthenticated() - Returns boolean whether user is authenticated
  • refreshSession - Force a refresh on current session token using an existing valid refresh token.
  • refreshUser - Force a refresh on current user using an existing valid refresh token.
  • isSessionTokenExpired(token = getSessionToken()) - Check whether the current session token is expired. Provide a session token if is not persisted.
  • isRefreshTokenExpired(token = getRefreshToken()) - Check whether the current refresh token is expired. Provide a refresh token if is not persisted.
  • getJwtRoles(token = getSessionToken(), tenant = '') - Get current roles from an existing session token. Provide tenant id for specific tenant roles.
  • getJwtPermissions(token = getSessionToken(), tenant = '') - Fet current permissions from an existing session token. Provide tenant id for specific tenant permissions.

Refresh token lifecycle

Descope SDK is automatically refreshes the session token when it is about to expire. This is done in the background using the refresh token, without any additional configuration.

If the Descope project settings are configured to manage tokens in cookies. you must also configure a custom domain, and set it as the baseUrl in DescopeAuthModule.

Descope Guard

angular-sdk provides a convenient route guard that prevents from accessing given route for users that are not authenticated:

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { ProtectedComponent } from './protected/protected.component';
import { descopeAuthGuard } from '@descope/angular-sdk';
import { LoginComponent } from './login/login.component';

const routes: Routes = [
	{
		path: 'step-up',
		component: ProtectedComponent,
		canActivate: [descopeAuthGuard],
		data: { descopeFallbackUrl: '/' }
	},
	{ path: 'login', component: LoginComponent },
	{ path: '**', component: HomeComponent }
];

@NgModule({
	imports: [RouterModule.forRoot(routes, { enableTracing: false })],
	exports: [RouterModule]
})
export class AppRoutingModule {}

If not authenticated user tries to access protected route they will be redirected to descopeFallbackUrl

Token Persistence

Descope stores two tokens: the session token and the refresh token.

  • The refresh token is either stored in local storage or an httpOnly cookie. This is configurable in the Descope console.
  • The session token is stored in either local storage or a JS cookie. This behavior is configurable via the sessionTokenViaCookie prop in the DescopeAuthModule module.

However, for security reasons, you may choose not to store tokens in the browser. In this case, you can pass persistTokens: false to the DescopeAuthModule module. This prevents the SDK from storing the tokens in the browser.

Notes:

  • You must configure the refresh token to be stored in an httpOnly cookie in the Descope console. Otherwise, the refresh token will not be stored, and when the page is refreshed, the user will be logged out.
  • You can still retrieve the session token using the session observable of DescopeAuthService.

Last User Persistence

Descope stores the last user information in local storage. If you wish to disable this feature, you can pass storeLastAuthenticatedUser: false to the DescopeAuthModule module. Please note that some features related to the last authenticated user may not function as expected if this behavior is disabled.

Widgets

Widgets are components that allow you to expose management features for tenant-based implementation. In certain scenarios, your customers may require the capability to perform managerial actions independently, alleviating the necessity to contact you. Widgets serve as a feature enabling you to delegate these capabilities to your customers in a modular manner.

Important Note:

  • For the user to be able to use the widget, they need to be assigned the Tenant Admin Role.

User Management

The UserManagement widget will let you embed a user table in your site to view and take action.

The widget lets you:

  • Create a new user
  • Edit an existing user
  • Activate / disable an existing user
  • Reset an existing user's password
  • Remove an existing user's passkey
  • Delete an existing user

Note:

  • Custom fields also appear in the table.
Usage
<user-management tenant="tenant-id" widgetId="user-management-widget" />

Example: Manage Users

Role Management

The RoleManagement widget will let you embed a role table in your site to view and take action.

The widget lets you:

  • Create a new role
  • Change an existing role's fields
  • Delete an existing role

Note:

  • The Editable field is determined by the user's access to the role - meaning that project-level roles are not editable by tenant level users.
  • You need to pre-define the permissions that the user can use, which are not editable in the widget.
Usage
<role-management tenant="tenant-id" widgetId="role-management-widget" />

Example: Manage Roles

AccessKeyManagement

The AccessKeyManagement widget will let you embed an access key table in your site to view and take action.

The widget lets you:

  • Create a new access key
  • Activate / deactivate an existing access key
  • Delete an exising access key
Usage
<!-- admin view: manage all tenant users' access keys -->
<access-key-management
	tenant="tenant-id"
	widgetId="access-key-management-widget"
/>

<!-- user view: mange access key for the logged-in tenant's user -->
<access-key-management
	tenant="tenant-id"
	widgetId="user-access-key-management-widget"
/>

Example: Manage Access Keys

AuditManagement

The AuditManagement widget will let you embed an audit table in your site.

Usage
<audit-management tenant="tenant-id" widgetId="audit-management-widget" />

Example: Manage Audit

UserProfile

The UserProfile widget lets you embed a user profile component in your app and let the logged in user update his profile.

The widget lets you:

  • Update user profile picture
  • Update user personal information
  • Update authentication methods
  • Logout
Usage
<user-profile widgetId="user-profile-widget"
(logout)="<your_logout_function>"
/>

Example: My User Profile

Code Example

You can find an example angular app in the examples folder.

Setup

To run the examples, create environment.development.ts file in environments folder.

import { Env } from './conifg';

export const environment: Env = {
	descopeProjectId: '<your_project_id>'
};

Find your Project ID in the Descope console.

Run Example

Run the following command in the root of the project to build and run the example:

npm i && npm start

Example Optional Env Variables

See the following table for customization environment variables for the example app:

Env Variable Description Default value
descopeFlowId Which flow ID to use in the login page sign-up-or-in
descopeBaseUrl Custom Descope base URL None
descopeTheme Flow theme None
descopeLocale Flow locale Browser's locale
descopeRedirectUrl Flow redirect URL for OAuth/SSO/Magic Link/Enchanted Link None
descopeTenantId Flow tenant ID for SSO/SAML None
descopeDebugMode "true" - Enable debugger
"false" - Disable flow debugger
None
descopeStepUpFlowId Step up flow ID to show to logged in user (via button). e.g. "step-up". Button will be hidden if not provided None
descopeTelemetryKey String - Telemetry public key provided by Descope Inc None
descopeBackendUrl Url to your test backend app in case you want to test e2e None

Example environment.development.ts file:

import { Env } from './conifg';

export const environment: Env = {
	descopeProjectId: '<your_project_id>',
	descopeBaseUrl: '<your_base_url>',
	descopeFlowId: 'sign-in',
	descopeDebugMode: false,
	descopeTheme: 'os',
	descopeLocale: 'en_US',
	descopeRedirectUrl: '<your_redirect_url>',
	descopeTelemetryKey: '<your_telemetry_key>',
	descopeStepUpFlowId: 'step-up',
	descopeBackendUrl: 'http://localhost:8080/protected'
};

Troubleshooting

If you encounter warning during build of your application:

โ–ฒ [WARNING] Module 'lodash.get' used by 'node_modules/@descope/web-component/node_modules/@descope/core-js-sdk/dist/index.esm.js' is not ESM

add lodash.get to allowed CommonJS dependencies in angular.json

"architect": {
	"build": {
		"builder": "@angular-devkit/build-angular:browser",
		"options": {
			"allowedCommonJsDependencies": ["lodash.get"],
			<other_options>
		}
		<other_config>
	}
	<other_config>
}

FAQ

I updated the user in my backend, but the user / session token are not updated in the frontend

The Descope SDK caches the user and session token in the frontend. If you update the user in your backend (using Descope Management SDK/API for example), you can call me / refresh from descopeSdk member of DescopeAuthService to refresh the user and session token. Example:

import { DescopeAuthService } from '@descope/angular-sdk';

export class MyComponent {
	// ...
	constructor(private authService: DescopeAuthService) {}

	handleUpdateUser() {
		myBackendUpdateUser().then(() => {
			this.authService.descopeSdk.me();
			// or
			this.authService.descopeSdk.refresh();
		});
	}
}

Learn More

To learn more please see the Descope Documentation and API reference page.

Contact Us

If you need help you can email Descope Support

License

The Descope SDK for Angular is licensed for use under the terms and conditions of the MIT license Agreement.

angular-sdk's People

Contributors

asafshen avatar dependabot[bot] avatar descope[bot] avatar dorsha avatar itaihanski avatar mf57 avatar nirgur avatar renovate[bot] avatar ruvenzx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jrpribs

angular-sdk's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): update typescript-eslint monorepo to v6.21.0 (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency jest-preset-angular to v14
  • chore(deps): update typescript-eslint monorepo to v7 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)

Pending Status Checks

These updates await pending status checks. To force their creation now, click the checkbox below.

  • fix(deps): update github.com/descope dependendies (@descope/access-key-management-widget, @descope/audit-management-widget, @descope/role-management-widget, @descope/user-management-widget, @descope/user-profile-widget, @descope/web-component)

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • devmasx/coverage-check-action v1.2.0
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/publish-next.yml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/publish.yml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/release.yml
  • actions/checkout v4
  • tibdex/github-app-token v1
npm
package.json
  • @descope/access-key-management-widget 0.1.68
  • @descope/audit-management-widget 0.1.31
  • @descope/role-management-widget 0.1.66
  • @descope/user-management-widget 0.4.68
  • @descope/user-profile-widget 0.0.34
  • @descope/web-component 3.12.0
  • tslib ^2.3.0
  • @angular-eslint/builder 16.3.1
  • @angular-eslint/eslint-plugin 16.3.1
  • @angular-eslint/eslint-plugin-template 16.3.1
  • @angular-eslint/schematics 16.3.1
  • @angular-eslint/template-parser 16.3.1
  • @angular/animations ^16.2.9
  • @angular/cli ^16.2.6
  • @angular/common ^16.2.9
  • @angular/compiler ^16.2.9
  • @angular/compiler-cli ^16.2.9
  • @angular/core ^16.2.9
  • @angular/forms ^16.2.9
  • @angular/platform-browser ^16.2.9
  • @angular/platform-browser-dynamic ^16.2.9
  • @angular/router ^16.2.9
  • @types/jest ^29.5.5
  • @typescript-eslint/eslint-plugin 6.12.0
  • @typescript-eslint/parser 6.12.0
  • eslint ^8.51.0
  • eslint-plugin-prettier ^4.2.1
  • husky ^8.0.3
  • jest ^29.7.0
  • jest-preset-angular ^13.1.2
  • lint-staged ^15.2.0
  • ng-mocks ^14.11.0
  • pretty-quick ^3.1.3
  • rxjs ~7.8.1
  • tslib ^2.6.2
  • zone.js ~0.13.0
  • @descope/web-js-sdk >=1
  • @angular/common >=16.0.0
  • @angular/core >=16.0.0
  • node ^16.14.0 || >=18.10.0
  • npm >= 8.1.0

  • Check this box to trigger a request for Renovate to run again on this repository

Demo App Improvements

  • remove theme switcher
  • make it look like react-sdk, while retaining angular specific concepts (ie. guards)
  • make it configurable with env vars like in react-sdk

Http Interceptor PoC

Write a PoC of Angular interceptor that:

  • add token to the headers
  • if request fails with 401/403 try to refresh token automatically
  • if token refresh succeds, retry the original request
  • if it fails fail the request

It should be configurable to which requests this interceptor should be applied

Package.json improvements

  • verify that required node engine matches angular one, so warnings on npm install are correct
  • turn of angular analytics question on npm install
  • review deps, move those not needed to peer deps or demo-app ones. Review bundle content
  • make sure imports in client apps are in correct format

Renaming

Please:

  • rename exposed sdk to descopeSdk
  • rename exposed descopeSession and descopeUser to session, user
  • remember to also update documentation

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Update angular-cli monorepo to v16.2.10 (@angular-devkit/build-angular, @angular/cli)
  • Update dependency @types/jest to v29.5.10
  • Update dependency @descope/web-component to v3.1.2
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
npm
package.json
  • @angular-devkit/build-angular ^16.2.6
  • @angular-eslint/builder 16.3.1
  • @angular-eslint/eslint-plugin 16.3.1
  • @angular-eslint/eslint-plugin-template 16.3.1
  • @angular-eslint/schematics 16.3.1
  • @angular-eslint/template-parser 16.3.1
  • @angular/animations ^16.2.9
  • @angular/cli ^16.2.6
  • @angular/common ^16.2.9
  • @angular/compiler ^16.2.9
  • @angular/compiler-cli ^16.2.9
  • @angular/core ^16.2.9
  • @angular/forms ^16.2.9
  • @angular/platform-browser ^16.2.9
  • @angular/platform-browser-dynamic ^16.2.9
  • @angular/router ^16.2.9
  • @descope/web-component 3.0.0
  • @types/jest ^29.5.5
  • @typescript-eslint/eslint-plugin 6.11.0
  • @typescript-eslint/parser 6.11.0
  • eslint ^8.51.0
  • jest ^29.7.0
  • jest-preset-angular ^13.1.2
  • ng-mocks ^14.11.0
  • ng-packagr ^16.2.3
  • prettier 3.0.3
  • rxjs ~7.8.1
  • tslib ^2.6.2
  • typescript ~5.1.6
  • zone.js ~0.13.0
  • node ^16.14.0 || ^18.10.0
  • npm >= 8.1.0
projects/angular-sdk/package.json
  • tslib ^2.3.0
  • @descope/web-component 3.0.0
  • @descope/web-js-sdk >=1
  • @angular/common >=16.0.0
  • @angular/core >=16.0.0
  • node ^16.14.0 || ^18.10.0
  • npm >= 8.1.0

  • Check this box to trigger a request for Renovate to run again on this repository

PoC for Simple Password Flow

Please implement password flow:

  • demo app should be able to connect to a Descope project
  • a user should be able to signup with password method
  • user should be able to login/logout with password method

Reactive Session and User Access

Implement similar functionality to useSession and useUser where library client can access session and user info in a reactive way. Meaning if session/user will be changed, all subscribed components will be able to react to that.

Setup Library Boilerplate

Please setup SDK boilerplate. It should be able to:

  • build library
  • run linter (use a industry standard config)
  • run unit tests (use jest)
  • have a config for formatter (use industry standard prettier config)
  • it should be able to run above in a Github Action
  • setup other minor library necessities (pre-commit, readme, etc.)

Fix Build

Building library is failing due to:

Building Angular Package

------------------------------------------------------------------------------
Building entry point 'angular-sdk'
------------------------------------------------------------------------------
โœ– Compiling with Angular sources in Ivy partial compilation mode.
node_modules/@descope/web-js-sdk/dist/index.d.ts:1:23 - error TS2688: Cannot find type definition file for 'core-js-sdk'.

1 /// <reference types="core-js-sdk" />
                        ~~~~~~~~~~~

Please fix that

Expose Entire SDK Object

Instead of exposing singular methods form sdk, expose entire sdk object. Use wrapWith from core package

Magic Link not working

Please investigate why magic link is not working (it doesn't correctly redirect to protected paths after successful login)

SDK Minor Improvements

  • make descope user optional in types
  • remove complete recreating web component on input change

Descope Component PoC

Please implement PoC for Descope Component created in Descope Platform.

Component should behave in the same way as in react-sdk, have same inputs and outputs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.