@newgameplusinc/odyssey-sso 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ ## Odyssey SSO SDK
@@ -0,0 +1,4 @@
1
+ export declare const SDK_NAME = "@newgameplusinc/odyssey-sso";
2
+ export declare const SDK_VERSION = "0.1.0";
3
+ export declare const SSO_SERVER_URL = "https://api-gateway.tenant-newgameproduction-ctrlpln.ord1.ingress.coreweave.cloud/sso";
4
+ export declare const SSO_CLIENT_URL = "https://odyssey-sso-client.vercel.app";
@@ -0,0 +1,30 @@
1
+ import Axios from "./lib/axios";
2
+ export default class OdysseySSO extends Axios {
3
+ private readonly isBrowser;
4
+ private debug;
5
+ private clientId;
6
+ private apiKey;
7
+ constructor({ apiKey, clientId, debug, }: {
8
+ apiKey: string;
9
+ clientId: string;
10
+ debug?: boolean;
11
+ });
12
+ readonly triggerSignIn: (callbackUrl: string) => Promise<void>;
13
+ private readonly exchangeCall;
14
+ /**
15
+ * @param code - the token you got from the callback
16
+ * @param clientSecret - keep it empty for client side exchange, for better security use clientSecret from your server
17
+ */
18
+ readonly exchangeCode: (token?: string, clientSecret?: string) => Promise<{
19
+ readonly isSuccess: true;
20
+ readonly data: {
21
+ readonly accessToken: string;
22
+ readonly refreshToken: string;
23
+ };
24
+ } | {
25
+ readonly isSuccess: false;
26
+ readonly data: null;
27
+ }>;
28
+ readonly refreshToken: (refreshToken: string) => Promise<void>;
29
+ readonly updateAvatar: (avatar: string) => Promise<void>;
30
+ }