@authara/react-native 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +250 -2
- package/dist/button-appearance.d.ts +43 -0
- package/dist/button-appearance.js +103 -0
- package/dist/button-contract.d.ts +69 -0
- package/dist/button-contract.js +17 -0
- package/dist/button-error.d.ts +40 -0
- package/dist/button-error.js +70 -0
- package/dist/buttons.d.ts +53 -0
- package/dist/buttons.js +195 -0
- package/dist/client.d.ts +65 -0
- package/dist/client.js +190 -0
- package/dist/context.d.ts +12 -0
- package/dist/context.js +16 -0
- package/dist/expo-apple-authentication.d.ts +2 -0
- package/dist/expo-apple-authentication.js +38 -0
- package/dist/expo-microsoft-auth-session.d.ts +7 -0
- package/dist/expo-microsoft-auth-session.js +57 -0
- package/dist/expo-secure-store.d.ts +6 -0
- package/dist/expo-secure-store.js +9 -0
- package/dist/generated/api.d.ts +296 -0
- package/dist/generated/api.js +381 -0
- package/dist/generated/error-codes.d.ts +8 -0
- package/dist/generated/error-codes.js +42 -0
- package/dist/generated/types.d.ts +355 -0
- package/dist/generated/types.js +2 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +8 -0
- package/dist/native-client.d.ts +43 -0
- package/dist/native-client.js +215 -0
- package/dist/nitro-google-signin.d.ts +5 -0
- package/dist/nitro-google-signin.js +25 -0
- package/dist/storage.d.ts +6 -0
- package/dist/storage.js +14 -0
- package/package.json +114 -4
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GoogleOneTapSignIn, isCancelledResponse, isSuccessResponse, } from "react-native-nitro-google-signin";
|
|
2
|
+
export function createNitroGoogleSignIn(config = {}) {
|
|
3
|
+
return {
|
|
4
|
+
async authorize(options) {
|
|
5
|
+
if (!config.iosClientId) {
|
|
6
|
+
throw new Error("Google native sign-in needs AUTHARA_OAUTH_GOOGLE_IOS_CLIENT_ID in the React Native .env");
|
|
7
|
+
}
|
|
8
|
+
GoogleOneTapSignIn.configure({
|
|
9
|
+
webClientId: options.client_id,
|
|
10
|
+
iosClientId: config.iosClientId,
|
|
11
|
+
nonce: options.nonce,
|
|
12
|
+
autoSelectOnSignIn: false,
|
|
13
|
+
});
|
|
14
|
+
await GoogleOneTapSignIn.checkPlayServices(true);
|
|
15
|
+
const response = await GoogleOneTapSignIn.presentExplicitSignIn();
|
|
16
|
+
if (isCancelledResponse(response)) {
|
|
17
|
+
throw new Error("Google sign-in was cancelled");
|
|
18
|
+
}
|
|
19
|
+
if (!isSuccessResponse(response) || !response.data.idToken) {
|
|
20
|
+
throw new Error("Google did not return an ID token");
|
|
21
|
+
}
|
|
22
|
+
return { credential: response.data.idToken };
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
package/dist/storage.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function createMemoryTokenStorage() {
|
|
2
|
+
let refreshToken = null;
|
|
3
|
+
return {
|
|
4
|
+
async getRefreshToken() {
|
|
5
|
+
return refreshToken;
|
|
6
|
+
},
|
|
7
|
+
async setRefreshToken(token) {
|
|
8
|
+
refreshToken = token;
|
|
9
|
+
},
|
|
10
|
+
async removeRefreshToken() {
|
|
11
|
+
refreshToken = null;
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,116 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authara/react-native",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Official React Native client, hooks, and native-provider buttons for Authara",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"authentication",
|
|
7
|
+
"expo",
|
|
8
|
+
"oauth",
|
|
9
|
+
"react-native",
|
|
10
|
+
"typescript"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/authara-org/authara-react-native.git"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/authara-org/authara-react-native#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/authara-org/authara-react-native/issues"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public",
|
|
27
|
+
"provenance": true
|
|
28
|
+
},
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./expo-secure-store": {
|
|
35
|
+
"import": "./dist/expo-secure-store.js",
|
|
36
|
+
"types": "./dist/expo-secure-store.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"./expo-apple-authentication": {
|
|
39
|
+
"import": "./dist/expo-apple-authentication.js",
|
|
40
|
+
"types": "./dist/expo-apple-authentication.d.ts"
|
|
41
|
+
},
|
|
42
|
+
"./nitro-google-signin": {
|
|
43
|
+
"import": "./dist/nitro-google-signin.js",
|
|
44
|
+
"types": "./dist/nitro-google-signin.d.ts"
|
|
45
|
+
},
|
|
46
|
+
"./expo-microsoft-auth-session": {
|
|
47
|
+
"import": "./dist/expo-microsoft-auth-session.js",
|
|
48
|
+
"types": "./dist/expo-microsoft-auth-session.d.ts"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"dist",
|
|
53
|
+
"README.md",
|
|
54
|
+
"LICENSE"
|
|
55
|
+
],
|
|
56
|
+
"scripts": {
|
|
57
|
+
"generate": "node scripts/generate.mjs",
|
|
58
|
+
"check:generated": "node scripts/generate.mjs --check",
|
|
59
|
+
"build": "tsc -p tsconfig.json",
|
|
60
|
+
"test": "npm run test:typecheck && vitest run",
|
|
61
|
+
"test:typecheck": "tsc -p tsconfig.test.json",
|
|
62
|
+
"check:format": "prettier --check \"src/**/*.{ts,tsx}\" \"examples/ios-simulator/**/*.{ts,tsx,cjs,md}\" \"scripts/**/*.mjs\" \"vitest.config.ts\" \"docker-compose.playground*.yaml\" \"README.md\"",
|
|
63
|
+
"format": "prettier --write \"src/**/*.{ts,tsx}\" \"examples/ios-simulator/**/*.{ts,tsx,cjs,md}\" \"scripts/**/*.mjs\" \"vitest.config.ts\" \"docker-compose.playground*.yaml\" \"README.md\"",
|
|
64
|
+
"example:core": "bash scripts/example-core.sh up",
|
|
65
|
+
"example:core:down": "bash scripts/example-core.sh down",
|
|
66
|
+
"example:core:logs": "bash scripts/example-core.sh logs",
|
|
67
|
+
"example:ios": "bash scripts/example-ios.sh native",
|
|
68
|
+
"example:ios:go": "bash scripts/example-ios.sh go",
|
|
69
|
+
"example:typecheck": "npm --prefix examples/ios-simulator run typecheck",
|
|
70
|
+
"prepublishOnly": "npm run check:generated && npm run build"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"expo-apple-authentication": ">=7 <9",
|
|
74
|
+
"expo-auth-session": ">=6 <8",
|
|
75
|
+
"expo-secure-store": ">=14 <16",
|
|
76
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
77
|
+
"react-native": ">=0.76",
|
|
78
|
+
"react-native-nitro-google-signin": ">=2 <3",
|
|
79
|
+
"react-native-nitro-modules": ">=0.36 <1",
|
|
80
|
+
"react-native-svg": ">=15 <16"
|
|
81
|
+
},
|
|
82
|
+
"peerDependenciesMeta": {
|
|
83
|
+
"expo-apple-authentication": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"expo-auth-session": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"expo-secure-store": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"react-native-nitro-google-signin": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"react-native-nitro-modules": {
|
|
96
|
+
"optional": true
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"devDependencies": {
|
|
100
|
+
"@types/react": "^19.2.14",
|
|
101
|
+
"expo-apple-authentication": "~8.0.8",
|
|
102
|
+
"expo-auth-session": "~7.0.11",
|
|
103
|
+
"expo-secure-store": "^15.0.8",
|
|
104
|
+
"expo-web-browser": "~15.0.11",
|
|
105
|
+
"prettier": "^3.8.1",
|
|
106
|
+
"react": "^19.1.1",
|
|
107
|
+
"react-native": "^0.81.0",
|
|
108
|
+
"react-native-nitro-google-signin": "^2.3.0",
|
|
109
|
+
"react-native-nitro-modules": "^0.37.1",
|
|
110
|
+
"react-native-svg": "^15.15.4",
|
|
111
|
+
"test-renderer": "1.3.1",
|
|
112
|
+
"typescript": "^5.9.3",
|
|
113
|
+
"vitest": "^4.0.18",
|
|
114
|
+
"yaml": "^2.9.0"
|
|
115
|
+
}
|
|
116
|
+
}
|