Ancient8 Connect UMD library.
This is the server APIs version. The implementation below will be only valid when in nodejs environment.
For detail of browser APIs please refer the docs.
For detail of server APIs please refer the docs.
For detail of adapter APIs please refer the docs.
$ yarn add @ancient8/connect
Please see the demo here
2 main usages for A8ServerConnect
.
/**
* Use OAuth APIs
*/
import {
init,
Types,
getA8ServerConnectInstance
} from "@ancient8/connect/server"
init({
// Must initialize with oauth credential
withOAuthCredential: oauthCredential as Types.ConnectOAuthDto.OAuthCredential
});
const instance = getA8ServerConnectInstance();
const authorizedUserId = "abcyxz";
console.log(
await instance.currentSession.OAuth.getUserInfo(authorizedUserId)
);
/**
* Use non-oauth APIs
*/
import {
init,
getA8ServerConnectInstance
} from "@ancient8/connect/server"
init({
// can be bearer jwt (can be obtained after successfully login)
withCredential: authToken as string,
// or use cookie credential (extracted from request header)
withCookieCredential: cookieCredential as string,
});
const instance = getA8ServerConnectInstance();
console.log(
await instance.currentSession.User.getUserProfile()
);
This library is still in beta development. Significant changes may happen anytime.
If you have any inquiries please send emails to [email protected].
Copyright (c) 2022 Ancient8.
Licensed under the GPL-3.0
Generated using TypeDoc