Add authentication
Squid integrates with a variety of different authentication providers, including OpenId
providers like Auth0, Okta, and Cognito. By connecting them to Squid, you can authorize user actions like querying and updating data, calling executables, etc.
Learn more about the OpenId protocol here.
How it works
To start using authentication with Squid you'll first need to add an Auth
integration in the Squid Console. A full list of the available Auth integrations can be found here.
Squid does not issue any authentication tokens when integrating with an auth provider. Instead, tokens that are issued by your provider must be passed to Squid. To authenticate users and extract their details, Squid relies on an access token sent from the client application to the Squid Server. Squid retrieves a token on demand for every request made to the backend:
const authProvider: SquidAuthProvider = {
getToken: () => 'USER_AUTH_ID_TOKEN',
integrationId: 'auth_INTEGRATION_ID',
};
squid.setAuthProvider(authProvider);
This token is used by Squid to make authentication details available within the functions in your backend project. You can then use these details to ensure that the user is authenticated and authorized when making requests.
Since Squid calls the getToken method for every request, it is practical to enable caching of the token within the getToken method and renew it only when the token approaches its expiration date.
Explore
To get started with adding authentication to your Squid application, simply click the Add auth provider
button on the application overview and select your preferred integration.
In this guide we'll explore adding the Auth0 integration:
Auth0
Integrate with Auth0 authentication service to secure your services using the Auth0 token.
Firebase Authentication
Integrate Firebase Authentication with Squid to manage access to Squid resources through the Squid Client and Backend SDKs.
👤 Role-Based Access Control (RBAC)
Manage user roles in the Squid backend to secure access to resources
🔒 Securing data
Manage access to data using client authentication and backend functionality