The AAA SDK for Web is built on top of react, oidc-react, and typescript. This SDK can be used for authentication, maintaining access tokens, fetching user info, and appending headers to the REST API calls.
To learn more about AAA, see Authentication And Authorization.
Install @os1-platform/aaa-web into your project.
The AAA SDK has the following peer dependencies:
Use the initCAS API of the SDK to create auth instance and fetch the AuthProvider component.
Wrap your application in this single AuthProvider component. For example:
Pass the loader component to the AuthProvider to override the default loader.
Use the loginWithRedirect method to initiate login.
Use the isAuthenticated method to put a check on private pages:This checks if the user has valid permissions to access private pages that require access via token, unlike public pages like the 'Contact Us' page.
Use the getAccessTokenSilently method, to fetch the access token.
Use the getUserInfo method, to fetch user info.
Use the HttpClient API to create a client for network requests.
The following headers are automatically configured to requests originating from the NetworkClient adding Access token(x-coreos-access) or the Tenant ID(x-coreos-tid) or User info(x-coreos-userinfo) or Auth token(x-coreos-auth) headers to the actual request.
- By default all these headers are true, i.e., will be passed to the REST API. The user needs to specifically pass value against these headers as false if they don't wish to pass certain headers.
- Access token is verified and regenerated (if expired), every time an API request is made.
- x-coreos-userinfo contains the userId.
- x-coreos-auth contains the id_token.
- Use the logout method, to implement logout functionality.
The AAA (Authentication And Authorization) SDK for mobile is used for authentication purposes to integrate with the front-end applications. This SDK is built on top of react-native, react-native-app-auth, and typescript. You can use this SDK on mobile for authentication, fetching access tokens, and logout features.
To learn more about AAA, see AAA Documentation.
Install @os1-platform/aaa-mobile into your project.
Add Manifest Placeholder in build.gradle (app level)
Init AAA SDKinitAuth0 initiates the authentication process and creates an instance of auth.
Initiate LogininitLogin() uses the auth instance and opens the web page on mobile containing the OS1 login page.
Fetch Access Token