Skip to main content

Angular Configuration

Example

src/environment/environment.ts
export const environment = {
cryptrConfig: {
tenant_domain: "your-tenant-domain-slug";
client_id: "your-cryptr-angular-client-id";
audience: "your-audience-url";
default_redirect_uri: "redirect-uri-to-authenticate-from-cryptr";
httpInterceptor: {
apiRequestsToSecure: [
'http://localhost:5000/api/cart_items',
'http://localhost:5000/api/v1/*',
]
},
},
};

Required Parameters

tenant_domain* STRING

The domain targetted for this Angular application integration

client_id* STRING

The ID reference of your application registered on Cryptr

audience* STRING

The URL of your Angular application

default_redirect_uri* STRING

The default URI of your application where your end-user will be redirected after Cryptr Authentication process

httpInterceptor.apiRequestsToSecure* STRING[]

Default value required

If you have a resource server you MUST define URL(s) in this property

List in httpInterceptor.apiRequestsToSecure URLs you want to be decorated with end-user authentication.

💡 You can either use precise strings or regex values

Learn more about Secure API Requests

Optional Parameters

default_locale STRING ['en', 'fr']

Default en

The default locale used to localize our components and used to define locale used on our cryptr screens

region STRING ['eu', 'us']

The region used to store your application and end-user data. We ensure that data-center and services are running in the chosen region

cryptr_base_url STRING

The Cryptr base server URL if NO region provided to target your authentication.

has_ssr boolean

Default undefined considered as false

Set this parameter to true if you have a Server-Side rendering (SSR) such as Universal for your Angular application that assure outside-in seamless routing. If you do not know, set to false or do not set key!

Why do we need this information ?

Let's assume you want to protect a path with a Cryptr authentication.

If you do not use SSR:

  • either set to false or do not set this key in the configuration
  • Prefer root path for default_redirect_uri, that will redirect end-user to your root path after authentication. And he'll need again to go to the secure path
Use root path if no SSR

If your Angular app is developed as SPA without SSR, we encourage you to set this param to your root path !

If you use a SSR:

  • set value to true You do not have nothing else to do, end-user will be redirected to the proper(requested) path at the end of the authentication process