tekoid-nodejs
How to install
- use npm/yarn:
npm install tekoid-nodejs
How to use
- First, import
ClientSDK
into your sourcecode. I.E:
import { Config, ClientSDK } from "tekoid-nodejs";
- Second, you need to instantiate ClientSDK. See example:
const config: Config = {
clientId: "id",
clientSecret: "secret",
redirectUri: "http://localhost:5000/callback"
};
clientSDK = new ClientSDK(config);
Note: redirectUri
must be declare in iam admin system
addition field | type | default |
---|---|---|
scope | array | ["openid","profile"] |
baseUri | string | https://oauth.tekoapis.com |
authorizePath | string | /oauth/authorize |
tokenPath | string | /oauth/token |
refreshTokenPath | string | /oauth/token |
revokeTokenPath | string | /oauth/revoke |
jwksPath | string | /.well-known/jwks.json |
verifySsl | boolean | true |
userInfoPath | string | /userinfo |
-
Support function:
-
getAuthorizationUrl():
- return url, state, nonce, codeVerifier
-
getToken(url, state, nonce = null, codeVerifier = null):
- use for authorization code flow, pass url get from authorization server and state get above
- codeVerifier is not require, use only for public client
- nonce is not require, use only when client require openid scope
- return token
-
getToken():
- use for client credentials flow
- return token
-
getUserInfo(token):
- pass id_token get above
- return user info
-
refreshToken(refreshToken):
- pass refresh token get from getToken()
- return new token
-
getFullUserInfo(accessToken):
- pass access_token get from getToken()
- return user info
-
-
you can see the sample code at https://git.teko.vn/user-profile/iam/tekoid-nodejs/-/blob/master/example/app.ts
Support
- vietnk: viet.nk@teko.vn