stopped at access token
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"projectName": "SafeQRFrontEndMobile",
|
"projectName": "safeqr",
|
||||||
"version": "3.1",
|
"version": "3.1",
|
||||||
"frontend": "javascript",
|
"frontend": "javascript",
|
||||||
"javascript": {
|
"javascript": {
|
||||||
|
|||||||
24
amplify/backend/auth/safeqr/parameters.json
Normal file
24
amplify/backend/auth/safeqr/parameters.json
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"authSelections": "identityPoolAndUserPool",
|
||||||
|
"resourceName": "safeqr",
|
||||||
|
"serviceType": "imported",
|
||||||
|
"region": "ap-southeast-1",
|
||||||
|
"usernameAttributes": [
|
||||||
|
"email"
|
||||||
|
],
|
||||||
|
"authProvidersUserPool": [
|
||||||
|
"Google"
|
||||||
|
],
|
||||||
|
"requiredAttributes": [
|
||||||
|
"email"
|
||||||
|
],
|
||||||
|
"passwordPolicyMinLength": 6,
|
||||||
|
"passwordPolicyCharacters": [],
|
||||||
|
"mfaConfiguration": "OPTIONAL",
|
||||||
|
"autoVerifiedAttributes": [
|
||||||
|
"email"
|
||||||
|
],
|
||||||
|
"mfaTypes": [
|
||||||
|
"TOTP"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "1",
|
|
||||||
"cognitoConfig": {
|
|
||||||
"identityPoolName": "safeqrfrontendmobile2d879dc9_identitypool_2d879dc9",
|
|
||||||
"allowUnauthenticatedIdentities": false,
|
|
||||||
"resourceNameTruncated": "safeqr2d879dc9",
|
|
||||||
"userPoolName": "safeqrfrontendmobile2d879dc9_userpool_2d879dc9",
|
|
||||||
"autoVerifiedAttributes": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"mfaConfiguration": "OFF",
|
|
||||||
"mfaTypes": [
|
|
||||||
"SMS Text Message"
|
|
||||||
],
|
|
||||||
"smsAuthenticationMessage": "Your authentication code is {####}",
|
|
||||||
"smsVerificationMessage": "Your verification code is {####}",
|
|
||||||
"emailVerificationSubject": "Your verification code",
|
|
||||||
"emailVerificationMessage": "Your verification code is {####}",
|
|
||||||
"defaultPasswordPolicy": false,
|
|
||||||
"passwordPolicyMinLength": 8,
|
|
||||||
"passwordPolicyCharacters": [],
|
|
||||||
"requiredAttributes": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"aliasAttributes": [],
|
|
||||||
"userpoolClientGenerateSecret": false,
|
|
||||||
"userpoolClientRefreshTokenValidity": 30,
|
|
||||||
"userpoolClientWriteAttributes": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"userpoolClientReadAttributes": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"userpoolClientLambdaRole": "safeqr2d879dc9_userpoolclient_lambda_role",
|
|
||||||
"userpoolClientSetAttributes": false,
|
|
||||||
"sharedId": "2d879dc9",
|
|
||||||
"resourceName": "safeqrfrontendmobile2d879dc9",
|
|
||||||
"authSelections": "identityPoolAndUserPool",
|
|
||||||
"useDefault": "defaultSocial",
|
|
||||||
"hostedUI": true,
|
|
||||||
"usernameAttributes": [
|
|
||||||
"email"
|
|
||||||
],
|
|
||||||
"hostedUIDomainName": "safeqrfrontendmobile2d879dc9-2d879dc9",
|
|
||||||
"authProvidersUserPool": [],
|
|
||||||
"hostedUIProviderMeta": "[]",
|
|
||||||
"userPoolGroupList": [],
|
|
||||||
"serviceName": "Cognito",
|
|
||||||
"usernameCaseSensitive": false,
|
|
||||||
"useEnabledMfas": true,
|
|
||||||
"authRoleArn": {
|
|
||||||
"Fn::GetAtt": [
|
|
||||||
"AuthRole",
|
|
||||||
"Arn"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"unauthRoleArn": {
|
|
||||||
"Fn::GetAtt": [
|
|
||||||
"UnauthRole",
|
|
||||||
"Arn"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"breakCircularDependency": true,
|
|
||||||
"dependsOn": [],
|
|
||||||
"oAuthMetadata": "{\"AllowedOAuthFlows\":[\"code\"],\"AllowedOAuthScopes\":[\"phone\",\"email\",\"openid\",\"profile\",\"aws.cognito.signin.user.admin\"],\"CallbackURLs\":[\"com.safeqr.safeqr://\"],\"LogoutURLs\":[\"com.safeqr.safeqr://\"]}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +1,109 @@
|
|||||||
{
|
{
|
||||||
"auth": {
|
"auth": {
|
||||||
"safeqrfrontendmobile2d879dc9": {
|
"safeqr": {
|
||||||
"customAuth": false,
|
"customAuth": false,
|
||||||
"dependsOn": [],
|
"dependsOn": [],
|
||||||
"frontendAuthConfig": {
|
|
||||||
"mfaConfiguration": "OFF",
|
|
||||||
"mfaTypes": [
|
|
||||||
"SMS"
|
|
||||||
],
|
|
||||||
"passwordProtectionSettings": {
|
|
||||||
"passwordPolicyCharacters": [],
|
|
||||||
"passwordPolicyMinLength": 8
|
|
||||||
},
|
|
||||||
"signupAttributes": [
|
|
||||||
"EMAIL"
|
|
||||||
],
|
|
||||||
"socialProviders": [],
|
|
||||||
"usernameAttributes": [
|
|
||||||
"EMAIL"
|
|
||||||
],
|
|
||||||
"verificationMechanisms": [
|
|
||||||
"EMAIL"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"providerPlugin": "awscloudformation",
|
"providerPlugin": "awscloudformation",
|
||||||
"service": "Cognito"
|
"service": "Cognito",
|
||||||
|
"serviceType": "imported"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": {
|
||||||
|
"AMPLIFY_auth_safeqr_allowUnauthenticatedIdentities": {
|
||||||
|
"usedBy": [
|
||||||
|
{
|
||||||
|
"category": "auth",
|
||||||
|
"resourceName": "safeqr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AMPLIFY_auth_safeqr_authRoleArn": {
|
||||||
|
"usedBy": [
|
||||||
|
{
|
||||||
|
"category": "auth",
|
||||||
|
"resourceName": "safeqr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AMPLIFY_auth_safeqr_authRoleName": {
|
||||||
|
"usedBy": [
|
||||||
|
{
|
||||||
|
"category": "auth",
|
||||||
|
"resourceName": "safeqr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AMPLIFY_auth_safeqr_googleClientId": {
|
||||||
|
"usedBy": [
|
||||||
|
{
|
||||||
|
"category": "auth",
|
||||||
|
"resourceName": "safeqr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AMPLIFY_auth_safeqr_identityPoolId": {
|
||||||
|
"usedBy": [
|
||||||
|
{
|
||||||
|
"category": "auth",
|
||||||
|
"resourceName": "safeqr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AMPLIFY_auth_safeqr_identityPoolName": {
|
||||||
|
"usedBy": [
|
||||||
|
{
|
||||||
|
"category": "auth",
|
||||||
|
"resourceName": "safeqr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AMPLIFY_auth_safeqr_nativeClientId": {
|
||||||
|
"usedBy": [
|
||||||
|
{
|
||||||
|
"category": "auth",
|
||||||
|
"resourceName": "safeqr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AMPLIFY_auth_safeqr_unauthRoleArn": {
|
||||||
|
"usedBy": [
|
||||||
|
{
|
||||||
|
"category": "auth",
|
||||||
|
"resourceName": "safeqr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AMPLIFY_auth_safeqr_unauthRoleName": {
|
||||||
|
"usedBy": [
|
||||||
|
{
|
||||||
|
"category": "auth",
|
||||||
|
"resourceName": "safeqr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AMPLIFY_auth_safeqr_userPoolId": {
|
||||||
|
"usedBy": [
|
||||||
|
{
|
||||||
|
"category": "auth",
|
||||||
|
"resourceName": "safeqr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AMPLIFY_auth_safeqr_userPoolName": {
|
||||||
|
"usedBy": [
|
||||||
|
{
|
||||||
|
"category": "auth",
|
||||||
|
"resourceName": "safeqr"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"AMPLIFY_auth_safeqr_webClientId": {
|
||||||
|
"usedBy": [
|
||||||
|
{
|
||||||
|
"category": "auth",
|
||||||
|
"resourceName": "safeqr"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,15 +1 @@
|
|||||||
export type AmplifyDependentResourcesAttributes = {
|
export type AmplifyDependentResourcesAttributes = {}
|
||||||
"auth": {
|
|
||||||
"safeqrfrontendmobile2d879dc9": {
|
|
||||||
"AppClientID": "string",
|
|
||||||
"AppClientIDWeb": "string",
|
|
||||||
"HostedUIDomain": "string",
|
|
||||||
"IdentityPoolId": "string",
|
|
||||||
"IdentityPoolName": "string",
|
|
||||||
"OAuthMetadata": "string",
|
|
||||||
"UserPoolArn": "string",
|
|
||||||
"UserPoolId": "string",
|
|
||||||
"UserPoolName": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
120
amplify/cli.json
120
amplify/cli.json
@@ -1,64 +1,64 @@
|
|||||||
{
|
{
|
||||||
"features": {
|
"features": {
|
||||||
"graphqltransformer": {
|
"graphqltransformer": {
|
||||||
"addmissingownerfields": true,
|
"addmissingownerfields": true,
|
||||||
"improvepluralization": false,
|
"improvepluralization": false,
|
||||||
"validatetypenamereservedwords": true,
|
"validatetypenamereservedwords": true,
|
||||||
"useexperimentalpipelinedtransformer": true,
|
"useexperimentalpipelinedtransformer": true,
|
||||||
"enableiterativegsiupdates": true,
|
"enableiterativegsiupdates": true,
|
||||||
"secondarykeyasgsi": true,
|
"secondarykeyasgsi": true,
|
||||||
"skipoverridemutationinputtypes": true,
|
"skipoverridemutationinputtypes": true,
|
||||||
"transformerversion": 2,
|
"transformerversion": 2,
|
||||||
"suppressschemamigrationprompt": true,
|
"suppressschemamigrationprompt": true,
|
||||||
"securityenhancementnotification": false,
|
"securityenhancementnotification": false,
|
||||||
"showfieldauthnotification": false,
|
"showfieldauthnotification": false,
|
||||||
"usesubusernamefordefaultidentityclaim": true,
|
"usesubusernamefordefaultidentityclaim": true,
|
||||||
"usefieldnameforprimarykeyconnectionfield": false,
|
"usefieldnameforprimarykeyconnectionfield": false,
|
||||||
"enableautoindexquerynames": true,
|
"enableautoindexquerynames": true,
|
||||||
"respectprimarykeyattributesonconnectionfield": true,
|
"respectprimarykeyattributesonconnectionfield": true,
|
||||||
"shoulddeepmergedirectiveconfigdefaults": false,
|
"shoulddeepmergedirectiveconfigdefaults": false,
|
||||||
"populateownerfieldforstaticgroupauth": true,
|
"populateownerfieldforstaticgroupauth": true,
|
||||||
"subscriptionsinheritprimaryauth": false
|
"subscriptionsinheritprimaryauth": false
|
||||||
|
},
|
||||||
|
"frontend-ios": {
|
||||||
|
"enablexcodeintegration": true
|
||||||
|
},
|
||||||
|
"auth": {
|
||||||
|
"enablecaseinsensitivity": true,
|
||||||
|
"useinclusiveterminology": true,
|
||||||
|
"breakcirculardependency": true,
|
||||||
|
"forcealiasattributes": false,
|
||||||
|
"useenabledmfas": true
|
||||||
|
},
|
||||||
|
"codegen": {
|
||||||
|
"useappsyncmodelgenplugin": true,
|
||||||
|
"usedocsgeneratorplugin": true,
|
||||||
|
"usetypesgeneratorplugin": true,
|
||||||
|
"cleangeneratedmodelsdirectory": true,
|
||||||
|
"retaincasestyle": true,
|
||||||
|
"addtimestampfields": true,
|
||||||
|
"handlelistnullabilitytransparently": true,
|
||||||
|
"emitauthprovider": true,
|
||||||
|
"generateindexrules": true,
|
||||||
|
"enabledartnullsafety": true,
|
||||||
|
"generatemodelsforlazyloadandcustomselectionset": false
|
||||||
|
},
|
||||||
|
"appsync": {
|
||||||
|
"generategraphqlpermissions": true
|
||||||
|
},
|
||||||
|
"latestregionsupport": {
|
||||||
|
"pinpoint": 1,
|
||||||
|
"translate": 1,
|
||||||
|
"transcribe": 1,
|
||||||
|
"rekognition": 1,
|
||||||
|
"textract": 1,
|
||||||
|
"comprehend": 1
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"overrides": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"frontend-ios": {
|
"debug": {
|
||||||
"enablexcodeintegration": true
|
"shareProjectConfig": false
|
||||||
},
|
|
||||||
"auth": {
|
|
||||||
"enablecaseinsensitivity": true,
|
|
||||||
"useinclusiveterminology": true,
|
|
||||||
"breakcirculardependency": true,
|
|
||||||
"forcealiasattributes": false,
|
|
||||||
"useenabledmfas": true
|
|
||||||
},
|
|
||||||
"codegen": {
|
|
||||||
"useappsyncmodelgenplugin": true,
|
|
||||||
"usedocsgeneratorplugin": true,
|
|
||||||
"usetypesgeneratorplugin": true,
|
|
||||||
"cleangeneratedmodelsdirectory": true,
|
|
||||||
"retaincasestyle": true,
|
|
||||||
"addtimestampfields": true,
|
|
||||||
"handlelistnullabilitytransparently": true,
|
|
||||||
"emitauthprovider": true,
|
|
||||||
"generateindexrules": true,
|
|
||||||
"enabledartnullsafety": true,
|
|
||||||
"generatemodelsforlazyloadandcustomselectionset": false
|
|
||||||
},
|
|
||||||
"appsync": {
|
|
||||||
"generategraphqlpermissions": true
|
|
||||||
},
|
|
||||||
"latestregionsupport": {
|
|
||||||
"pinpoint": 1,
|
|
||||||
"translate": 1,
|
|
||||||
"transcribe": 1,
|
|
||||||
"rekognition": 1,
|
|
||||||
"textract": 1,
|
|
||||||
"comprehend": 1
|
|
||||||
},
|
|
||||||
"project": {
|
|
||||||
"overrides": true
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"debug": {
|
|
||||||
"shareProjectConfig": false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,32 @@
|
|||||||
{
|
{
|
||||||
"dev": {
|
"dev": {
|
||||||
"awscloudformation": {
|
"awscloudformation": {
|
||||||
"AuthRoleName": "amplify-safeqrfrontendmobile-dev-d47dd-authRole",
|
"AuthRoleName": "amplify-safeqr-dev-45853-authRole",
|
||||||
"UnauthRoleArn": "arn:aws:iam::058264269465:role/amplify-safeqrfrontendmobile-dev-d47dd-unauthRole",
|
"UnauthRoleArn": "arn:aws:iam::058264269465:role/amplify-safeqr-dev-45853-unauthRole",
|
||||||
"AuthRoleArn": "arn:aws:iam::058264269465:role/amplify-safeqrfrontendmobile-dev-d47dd-authRole",
|
"AuthRoleArn": "arn:aws:iam::058264269465:role/amplify-safeqr-dev-45853-authRole",
|
||||||
"Region": "ap-southeast-1",
|
"Region": "ap-southeast-1",
|
||||||
"DeploymentBucketName": "amplify-safeqrfrontendmobile-dev-d47dd-deployment",
|
"DeploymentBucketName": "amplify-safeqr-dev-45853-deployment",
|
||||||
"UnauthRoleName": "amplify-safeqrfrontendmobile-dev-d47dd-unauthRole",
|
"UnauthRoleName": "amplify-safeqr-dev-45853-unauthRole",
|
||||||
"StackName": "amplify-safeqrfrontendmobile-dev-d47dd",
|
"StackName": "amplify-safeqr-dev-45853",
|
||||||
"StackId": "arn:aws:cloudformation:ap-southeast-1:058264269465:stack/amplify-safeqrfrontendmobile-dev-d47dd/6b855b50-3c40-11ef-b0cb-0aac1b92eadd",
|
"StackId": "arn:aws:cloudformation:ap-southeast-1:058264269465:stack/amplify-safeqr-dev-45853/df03aa80-48b3-11ef-8210-0285266ba73b",
|
||||||
"AmplifyAppId": "d2d2iszqi4kpe5"
|
"AmplifyAppId": "d3c5p62zte3j"
|
||||||
},
|
},
|
||||||
"categories": {
|
"categories": {
|
||||||
"auth": {
|
"auth": {
|
||||||
"safeqrfrontendmobile2d879dc9": {}
|
"safeqr": {
|
||||||
|
"userPoolId": "ap-southeast-1_zkxA0NZYN",
|
||||||
|
"userPoolName": "safeqr",
|
||||||
|
"webClientId": "6jfhnjr067t2cgamvst1uquj73",
|
||||||
|
"nativeClientId": "6jfhnjr067t2cgamvst1uquj73",
|
||||||
|
"identityPoolId": "ap-southeast-1:10ca3025-9e28-4f14-a07e-93f4f69e4473",
|
||||||
|
"identityPoolName": "safeqr-identity-pool",
|
||||||
|
"allowUnauthenticatedIdentities": true,
|
||||||
|
"authRoleArn": "arn:aws:iam::058264269465:role/service-role/amplify-iam-role",
|
||||||
|
"authRoleName": "amplify-iam-role",
|
||||||
|
"unauthRoleArn": "arn:aws:iam::058264269465:role/service-role/amplify-iam-guest",
|
||||||
|
"unauthRoleName": "amplify-iam-guest",
|
||||||
|
"googleClientId": "937053967427-1gcm0u1pp1mabrueeka475kt2st7o932.apps.googleusercontent.com"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
99
package-lock.json
generated
99
package-lock.json
generated
@@ -8,6 +8,7 @@
|
|||||||
"name": "safeqr",
|
"name": "safeqr",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@aws-amplify/auth": "^6.3.10",
|
||||||
"@aws-amplify/react-native": "^1.1.1",
|
"@aws-amplify/react-native": "^1.1.1",
|
||||||
"@aws-amplify/rtn-web-browser": "^1.0.30",
|
"@aws-amplify/rtn-web-browser": "^1.0.30",
|
||||||
"@aws-amplify/ui-react-native": "^2.2.2",
|
"@aws-amplify/ui-react-native": "^2.2.2",
|
||||||
@@ -17,7 +18,7 @@
|
|||||||
"@react-navigation/bottom-tabs": "^6.5.20",
|
"@react-navigation/bottom-tabs": "^6.5.20",
|
||||||
"@react-navigation/native": "^6.1.17",
|
"@react-navigation/native": "^6.1.17",
|
||||||
"@reduxjs/toolkit": "^2.2.6",
|
"@reduxjs/toolkit": "^2.2.6",
|
||||||
"aws-amplify": "^6.3.8",
|
"aws-amplify": "^6.4.2",
|
||||||
"axios": "^1.7.2",
|
"axios": "^1.7.2",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"expo": "~51.0.17",
|
"expo": "~51.0.17",
|
||||||
@@ -60,9 +61,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-amplify/analytics": {
|
"node_modules/@aws-amplify/analytics": {
|
||||||
"version": "7.0.36",
|
"version": "7.0.39",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-amplify/analytics/-/analytics-7.0.36.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-amplify/analytics/-/analytics-7.0.39.tgz",
|
||||||
"integrity": "sha512-fmEOlpLy74drPWIIiVVRgIXhE/7k2bMbtgq648gUEVFyt4nxxXCJh2K/v9NEnIICHyotYoRfwASr0ade7Chaow==",
|
"integrity": "sha512-Xvf1tT8JovSUVhlxfwbyUCJi8AWLEXHSqWYH0+131BrLZCYppcYmyPDUccJtFGwVXMStHn5yqlmYHTq6oabxsA==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-firehose": "3.398.0",
|
"@aws-sdk/client-firehose": "3.398.0",
|
||||||
@@ -76,24 +77,24 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-amplify/api": {
|
"node_modules/@aws-amplify/api": {
|
||||||
"version": "6.0.38",
|
"version": "6.0.41",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-amplify/api/-/api-6.0.38.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-amplify/api/-/api-6.0.41.tgz",
|
||||||
"integrity": "sha512-XlWFNzQaYBUTZXbhMvfNJPyvWTW0GT5r8JJd8S0PsW/mf2MLmIno9MMCwzNz8L2okMBVR4wXa2KoK6Vh+gNeyg==",
|
"integrity": "sha512-EDzlw9C6By2yyE4sRUxeBp1RZtvuonrYvXTCVpGxeWohCfYAIemFIuj4nCN6SRa2aVlueHX3IEM6AHDKqgZOpA==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-amplify/api-graphql": "4.1.7",
|
"@aws-amplify/api-graphql": "4.1.10",
|
||||||
"@aws-amplify/api-rest": "4.0.36",
|
"@aws-amplify/api-rest": "4.0.39",
|
||||||
"tslib": "^2.5.0"
|
"tslib": "^2.5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-amplify/api-graphql": {
|
"node_modules/@aws-amplify/api-graphql": {
|
||||||
"version": "4.1.7",
|
"version": "4.1.10",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-amplify/api-graphql/-/api-graphql-4.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-amplify/api-graphql/-/api-graphql-4.1.10.tgz",
|
||||||
"integrity": "sha512-5ip5xxhrw68G5nd35rtkmnWJZ8bwn47coWlk+S6HmKIkGhsmi57GfEy5qJkWJquKMoenomAlHA+Z4KUshOPJqg==",
|
"integrity": "sha512-ClFJbHaPjwCn2Ri35VB5tCBgcKuwTEhTQVNxmkZmaQrbd5yhbEKPt9bWMPlLHe37IA5RYNyFVFJyzdGPBfh8Xg==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-amplify/api-rest": "4.0.36",
|
"@aws-amplify/api-rest": "4.0.39",
|
||||||
"@aws-amplify/core": "6.3.3",
|
"@aws-amplify/core": "6.3.6",
|
||||||
"@aws-amplify/data-schema": "^1.0.0",
|
"@aws-amplify/data-schema": "^1.0.0",
|
||||||
"@aws-sdk/types": "3.387.0",
|
"@aws-sdk/types": "3.387.0",
|
||||||
"graphql": "15.8.0",
|
"graphql": "15.8.0",
|
||||||
@@ -116,9 +117,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-amplify/api-rest": {
|
"node_modules/@aws-amplify/api-rest": {
|
||||||
"version": "4.0.36",
|
"version": "4.0.39",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-amplify/api-rest/-/api-rest-4.0.36.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-amplify/api-rest/-/api-rest-4.0.39.tgz",
|
||||||
"integrity": "sha512-D8vIMFl5pHxs6BLrtSOudLtgbUBZbBhb6ctnNWcyZvHDfZJZs0PYwJLbOzsZSmnhYRtpqOWXbZctHW/0ngYosg==",
|
"integrity": "sha512-S3jrHb9hGQDyJxTVCQoKky5MLZDdqQxOH3p8vYOsOU8OtJ4dusrf2gLFqN2FAgyuK9yuc3aFvm4Hw6Zh7JfSgA==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.5.0"
|
"tslib": "^2.5.0"
|
||||||
@@ -128,9 +129,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-amplify/auth": {
|
"node_modules/@aws-amplify/auth": {
|
||||||
"version": "6.3.7",
|
"version": "6.3.10",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-amplify/auth/-/auth-6.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-amplify/auth/-/auth-6.3.10.tgz",
|
||||||
"integrity": "sha512-C+9IIyOKtb89l4ptPLu/9wPfVeEnEgZ/oAOytnLAedu/uheDeDX7QEwpL35nW6y9i4+G05DIlGwph9SK1gEHEw==",
|
"integrity": "sha512-vpYXytfd8V2ndAXxYpy/4ZgNnTmT75Wp/TLftwrLWJh1E0iBU+8gph4Zfj3OCK82oCXilw0kTVvoHI26ajkQgw==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.5.0"
|
"tslib": "^2.5.0"
|
||||||
@@ -140,9 +141,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-amplify/core": {
|
"node_modules/@aws-amplify/core": {
|
||||||
"version": "6.3.3",
|
"version": "6.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-amplify/core/-/core-6.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-amplify/core/-/core-6.3.6.tgz",
|
||||||
"integrity": "sha512-4GM3Q8x9YgXxQULCqgH3VPlX//K4TOrM1JbQ1eE5PsdVu+JrWpS1n86TvdULVnbspws16n3z73ALDKmnBZsx0g==",
|
"integrity": "sha512-xIARNd6u8GeBUPYlcAE4NzdKepOPOCCmPCNtfz3EVzxmjfcSk5p2Zu1r+ZRbCwQDLv0AKM+NPH4Qj8+6s0rY4g==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-crypto/sha256-js": "5.2.0",
|
"@aws-crypto/sha256-js": "5.2.0",
|
||||||
@@ -182,9 +183,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-amplify/data-schema": {
|
"node_modules/@aws-amplify/data-schema": {
|
||||||
"version": "1.3.4",
|
"version": "1.3.9",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-amplify/data-schema/-/data-schema-1.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-amplify/data-schema/-/data-schema-1.3.9.tgz",
|
||||||
"integrity": "sha512-hzfn9ER8UbdhoE4RGttDxJrnH6EAc7WBGRNa8NyKMVCMSlLUIvf8+XyX5e1zmEPLl48TtwuQvOd+CkhWrBraHg==",
|
"integrity": "sha512-3KMKcte/SosRksOVgE8Gj/EG94UEqhse1t8NRImQD4iEqAMkakGJNoIqS4/QTSD7vYCmuREU/hhWwT1ITE6f4w==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-amplify/data-schema-types": "*",
|
"@aws-amplify/data-schema-types": "*",
|
||||||
@@ -203,12 +204,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-amplify/datastore": {
|
"node_modules/@aws-amplify/datastore": {
|
||||||
"version": "5.0.38",
|
"version": "5.0.41",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-amplify/datastore/-/datastore-5.0.38.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-amplify/datastore/-/datastore-5.0.41.tgz",
|
||||||
"integrity": "sha512-DgIjFMjzTGXift6rVhMcrzzUvpYvrszaEbTe3OsS3SzYXnSTSPSRICFYR6MqVyLN8v3lPc1m5AY1rLsRj3O8YA==",
|
"integrity": "sha512-IMXfExS3/yYYwqtWsFeLSZd1H9Yz/xXian+8DHgmHjSjTVFUOyRm9HQ4hXZzoP1KyzGEAvpJqeV9wLT+Drg41Q==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-amplify/api": "6.0.38",
|
"@aws-amplify/api": "6.0.41",
|
||||||
"buffer": "4.9.2",
|
"buffer": "4.9.2",
|
||||||
"idb": "5.0.6",
|
"idb": "5.0.6",
|
||||||
"immer": "9.0.6",
|
"immer": "9.0.6",
|
||||||
@@ -241,9 +242,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-amplify/notifications": {
|
"node_modules/@aws-amplify/notifications": {
|
||||||
"version": "2.0.36",
|
"version": "2.0.39",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-amplify/notifications/-/notifications-2.0.36.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-amplify/notifications/-/notifications-2.0.39.tgz",
|
||||||
"integrity": "sha512-o2vf013m1fvyDPOl7qF399ph8GyQIw8a+tB+pEmWA29RFV4qJ7t/2k/4mpujdDrKtACrnHXjj/MK1taqVqPfLg==",
|
"integrity": "sha512-bR/LEDTzbYSgb7L2vqEPpeZLODTSycu/r7K2IuzDduvCcTB62UnNcgXg7yBuHwRFPCfkRtZFx0uevtciTGJfPA==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
@@ -299,9 +300,9 @@
|
|||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0"
|
||||||
},
|
},
|
||||||
"node_modules/@aws-amplify/storage": {
|
"node_modules/@aws-amplify/storage": {
|
||||||
"version": "6.4.7",
|
"version": "6.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-amplify/storage/-/storage-6.4.7.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-amplify/storage/-/storage-6.5.2.tgz",
|
||||||
"integrity": "sha512-5SXgtNwc3qjPCla/Qck2u5Fbr7NlBTaatMs/fL9VuosAfSiMG9/ZApZOUQlQSil7KKRSr19a/vIx0tv2jLg8IQ==",
|
"integrity": "sha512-6wxBE81qMw7vwdGvIhwTLXM/ZQ4nlgFb8p2QjhXqC4cm5mS0kUxGXhJJ7NdNjFMrax9qxULSi3LJePhzbConLw==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/types": "3.398.0",
|
"@aws-sdk/types": "3.398.0",
|
||||||
@@ -8714,9 +8715,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/aws-lambda": {
|
"node_modules/@types/aws-lambda": {
|
||||||
"version": "8.10.140",
|
"version": "8.10.141",
|
||||||
"resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.140.tgz",
|
"resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.141.tgz",
|
||||||
"integrity": "sha512-4Dh3dk2TUcbdfHrX0Al90mNGJDvA9NBiTQPzbrjGi/dLxzKCGOYgT8YQ47jUKNFALkAJAadifq0pzyjIUlhVhg==",
|
"integrity": "sha512-SMWlRBukG9KV8ZNjwemp2AzDibp/czIAeKKTw09nCPbWxVskIxactCJCGOp4y6I1hCMY7T7UGfySvBLXNeUbEw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/istanbul-lib-coverage": {
|
"node_modules/@types/istanbul-lib-coverage": {
|
||||||
@@ -9159,18 +9160,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/aws-amplify": {
|
"node_modules/aws-amplify": {
|
||||||
"version": "6.3.8",
|
"version": "6.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/aws-amplify/-/aws-amplify-6.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/aws-amplify/-/aws-amplify-6.4.2.tgz",
|
||||||
"integrity": "sha512-eplilc+XBr9lcJk9L4eNYEgTj5osBOIgeAuVMi+HEOUa8lh0ngf9NIbNjnJSo8F74OgVXnKCoiQPmV3z4B6Fgw==",
|
"integrity": "sha512-56VQJdLBTMZEjmYQ1h21tv5P6iCdUQjGlzmkLvUpa30LtsfvnQ+Aync750OB6VG5g0rL1A/H5sscnngCEodKtg==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-amplify/analytics": "7.0.36",
|
"@aws-amplify/analytics": "7.0.39",
|
||||||
"@aws-amplify/api": "6.0.38",
|
"@aws-amplify/api": "6.0.41",
|
||||||
"@aws-amplify/auth": "6.3.7",
|
"@aws-amplify/auth": "6.3.10",
|
||||||
"@aws-amplify/core": "6.3.3",
|
"@aws-amplify/core": "6.3.6",
|
||||||
"@aws-amplify/datastore": "5.0.38",
|
"@aws-amplify/datastore": "5.0.41",
|
||||||
"@aws-amplify/notifications": "2.0.36",
|
"@aws-amplify/notifications": "2.0.39",
|
||||||
"@aws-amplify/storage": "6.4.7",
|
"@aws-amplify/storage": "6.5.2",
|
||||||
"tslib": "^2.5.0"
|
"tslib": "^2.5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
"web": "expo start --web"
|
"web": "expo start --web"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@aws-amplify/auth": "^6.3.10",
|
||||||
"@aws-amplify/react-native": "^1.1.1",
|
"@aws-amplify/react-native": "^1.1.1",
|
||||||
"@aws-amplify/rtn-web-browser": "^1.0.30",
|
"@aws-amplify/rtn-web-browser": "^1.0.30",
|
||||||
"@aws-amplify/ui-react-native": "^2.2.2",
|
"@aws-amplify/ui-react-native": "^2.2.2",
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
"@react-navigation/bottom-tabs": "^6.5.20",
|
"@react-navigation/bottom-tabs": "^6.5.20",
|
||||||
"@react-navigation/native": "^6.1.17",
|
"@react-navigation/native": "^6.1.17",
|
||||||
"@reduxjs/toolkit": "^2.2.6",
|
"@reduxjs/toolkit": "^2.2.6",
|
||||||
"aws-amplify": "^6.3.8",
|
"aws-amplify": "^6.4.2",
|
||||||
"axios": "^1.7.2",
|
"axios": "^1.7.2",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"expo": "~51.0.17",
|
"expo": "~51.0.17",
|
||||||
|
|||||||
@@ -6,13 +6,11 @@ import { RootState } from '../store';
|
|||||||
interface QRCodeState {
|
interface QRCodeState {
|
||||||
qrCodes: QRCode[];
|
qrCodes: QRCode[];
|
||||||
histories: QRCodeType[] | null;
|
histories: QRCodeType[] | null;
|
||||||
bookmarks: QRCodeType[] | null;
|
|
||||||
userAttributes: UserAttributes;
|
userAttributes: UserAttributes;
|
||||||
}
|
}
|
||||||
const initialState: QRCodeState = {
|
const initialState: QRCodeState = {
|
||||||
qrCodes: [],
|
qrCodes: [],
|
||||||
histories: [],
|
histories: [],
|
||||||
bookmarks: [],
|
|
||||||
userAttributes: null,
|
userAttributes: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -69,9 +67,6 @@ const qrCodesSlice = createSlice({
|
|||||||
setScannedHistories(state, action: PayloadAction<QRCodeType[]>) {
|
setScannedHistories(state, action: PayloadAction<QRCodeType[]>) {
|
||||||
state.histories = action.payload;
|
state.histories = action.payload;
|
||||||
},
|
},
|
||||||
setBookmarks(state, action: PayloadAction<QRCodeType[]>) {
|
|
||||||
state.bookmarks = action.payload;
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,14 @@ import { useFocusEffect, useNavigation } from '@react-navigation/native';
|
|||||||
import * as ImagePicker from 'expo-image-picker';
|
import * as ImagePicker from 'expo-image-picker';
|
||||||
import ScannedDataBox from '../components/ScannedDataBox';
|
import ScannedDataBox from '../components/ScannedDataBox';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
|
import { RootState, AppDispatch } from '../store';
|
||||||
import { addQRCode } from '../reducers/qrCodesReducer'; // Assuming you have actions defined for Redux
|
import { addQRCode } from '../reducers/qrCodesReducer'; // Assuming you have actions defined for Redux
|
||||||
import { detectQRCodeType, verifyURL, checkRedirects } from '../api/qrCodeAPI'; // Import utility functions
|
import { detectQRCodeType, verifyURL, checkRedirects } from '../api/qrCodeAPI'; // Import utility functions
|
||||||
|
|
||||||
// Main Function
|
// Main Function
|
||||||
const QRScannerScreen: React.FC<{ clearScanData: () => void }> = ({ clearScanData }) => {
|
const QRScannerScreen: React.FC<{ clearScanData: () => void }> = ({ clearScanData }) => {
|
||||||
const navigation = useNavigation(); // call Navigation bar
|
const navigation = useNavigation(); // call Navigation bar
|
||||||
const dispatch = useDispatch(); // Use dispatch for Redux actions
|
const dispatch = useDispatch<AppDispatch>(); // Use dispatch for Redux actions
|
||||||
|
|
||||||
const [showSplash, setShowSplash] = useState<boolean>(true); // call splash screen
|
const [showSplash, setShowSplash] = useState<boolean>(true); // call splash screen
|
||||||
const qrCodeContext = useContext(QRCodeContext); // From ./types.ts
|
const qrCodeContext = useContext(QRCodeContext); // From ./types.ts
|
||||||
@@ -147,15 +148,6 @@ const QRScannerScreen: React.FC<{ clearScanData: () => void }> = ({ clearScanDat
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// // Clear scan data when screen is focused
|
|
||||||
// useEffect(() => {
|
|
||||||
// const unsubscribe = navigation.addListener('focus', () => {
|
|
||||||
// clearScanDataInternal();
|
|
||||||
// console.log("Screen focused, scan data cleared");
|
|
||||||
// });
|
|
||||||
// return unsubscribe;
|
|
||||||
// }, [navigation]);
|
|
||||||
|
|
||||||
// Clear scan data when screen is focused
|
// Clear scan data when screen is focused
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
@@ -206,9 +198,9 @@ const QRScannerScreen: React.FC<{ clearScanData: () => void }> = ({ clearScanDat
|
|||||||
<TouchableOpacity onPress={toggleTorch} style={styles.flashButton}>
|
<TouchableOpacity onPress={toggleTorch} style={styles.flashButton}>
|
||||||
<Ionicons name="flashlight" size={24} color="#fff" />
|
<Ionicons name="flashlight" size={24} color="#fff" />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity onPress={handleTestScan} style={styles.testButton}>
|
{/* <TouchableOpacity onPress={handleTestScan} style={styles.testButton}>
|
||||||
<Ionicons name="bug" size={24} color="#fff" />
|
<Ionicons name="bug" size={24} color="#fff" />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity> */}
|
||||||
<TouchableOpacity onPress={readQRFromImage} style={styles.galleryButton}>
|
<TouchableOpacity onPress={readQRFromImage} style={styles.galleryButton}>
|
||||||
<Ionicons name="image" size={24} color="#fff" />
|
<Ionicons name="image" size={24} color="#fff" />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
@@ -252,6 +244,8 @@ const styles = StyleSheet.create({
|
|||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
backgroundColor: '#f8f0fc',
|
backgroundColor: '#f8f0fc',
|
||||||
|
height: '100%',
|
||||||
|
width: '100%',
|
||||||
},
|
},
|
||||||
cameraContainer: {
|
cameraContainer: {
|
||||||
height: '60%',
|
height: '60%',
|
||||||
|
|||||||
@@ -1,15 +1,102 @@
|
|||||||
import { View, Text, StyleSheet, TouchableOpacity, Linking, Button } from 'react-native';
|
import { View, Text, StyleSheet, TouchableOpacity, Linking, Button } from 'react-native';
|
||||||
import { useAuthenticator } from '@aws-amplify/ui-react-native';
|
import { useAuthenticator } from '@aws-amplify/ui-react-native';
|
||||||
import useFetchUserAttributes from '../hooks/useFetchUserAttributes';
|
import useFetchUserAttributes from '../hooks/useFetchUserAttributes';
|
||||||
|
import { fetchAuthSession, getCurrentUser, signInWithRedirect } from 'aws-amplify/auth';
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { Buffer } from 'buffer';
|
||||||
|
|
||||||
|
|
||||||
function SignOutButton() {
|
function SignOutButton() {
|
||||||
const { signOut } = useAuthenticator();
|
const { signOut } = useAuthenticator();
|
||||||
return <Button title="Sign Out" onPress={signOut} />;
|
return <Button title="Sign Out" onPress={signOut} />;
|
||||||
}
|
}
|
||||||
|
const handleSignInWithRedirect = async () => {
|
||||||
|
try {
|
||||||
|
await signInWithRedirect();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error during sign in:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const SettingsScreen: React.FC = () => {
|
const SettingsScreen: React.FC = () => {
|
||||||
const { userAttributes } = useFetchUserAttributes();
|
const { userAttributes } = useFetchUserAttributes();
|
||||||
|
const [googleAccessToken, setGoogleAccessToken] = useState<string | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const getGoogleAccessToken = async () => {
|
||||||
|
try {
|
||||||
|
const currentUser = await getCurrentUser();
|
||||||
|
console.log('Current user:', currentUser);
|
||||||
|
|
||||||
|
const { tokens } = await fetchAuthSession();
|
||||||
|
const test = await fetchAuthSession();
|
||||||
|
console.log('Tokens:', tokens);
|
||||||
|
console.log("aws access token: ", tokens.accessToken.toString());
|
||||||
|
console.log("test ", test);
|
||||||
|
|
||||||
|
if (tokens?.idToken) {
|
||||||
|
const idToken = tokens.idToken.toString();
|
||||||
|
console.log('ID Token:', idToken);
|
||||||
|
|
||||||
|
const parts = idToken.split('.');
|
||||||
|
if (parts.length !== 3) {
|
||||||
|
throw new Error('ID token is not a valid JWT');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const payload = parts[1];
|
||||||
|
const decodedPayload = Buffer.from(payload, 'base64').toString('utf8');
|
||||||
|
console.log('Decoded payload:', decodedPayload);
|
||||||
|
|
||||||
|
let parsedPayload;
|
||||||
|
try {
|
||||||
|
parsedPayload = JSON.parse(decodedPayload);
|
||||||
|
} catch (parseError) {
|
||||||
|
console.error('Error parsing payload:', parseError);
|
||||||
|
console.error(`Parse error: ${parseError.message}\nPayload: ${decodedPayload}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Parsed payload:', parsedPayload);
|
||||||
|
// Options for toLocaleString
|
||||||
|
const options: Intl.DateTimeFormatOptions = {
|
||||||
|
timeZone: 'Asia/Singapore', // UTC+8 timezone
|
||||||
|
year: 'numeric',
|
||||||
|
month: '2-digit',
|
||||||
|
day: '2-digit',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
second: '2-digit'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
if (parsedPayload["custom:access_token"]) {
|
||||||
|
console.log('Google Access Token:', parsedPayload["custom:access_token"]);
|
||||||
|
console.log('Google Refresh Token: ', parsedPayload["custom:refresh_token"]);
|
||||||
|
|
||||||
|
setGoogleAccessToken(parsedPayload["custom:access_token"]);
|
||||||
|
console.log("auth_time: ", new Date(parsedPayload.auth_time * 1000).toLocaleString('en-US', options));
|
||||||
|
console.log("iat: ", new Date(parsedPayload.iat * 1000).toLocaleString('en-US', options));
|
||||||
|
console.log("expiry: ", new Date(parsedPayload.exp * 1000).toLocaleString('en-US', options));
|
||||||
|
console.log("date created: ", new Date(1721715837500).toLocaleString('en-US', options));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.error('No Google access token found in the payload');
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.error('No ID token found in the session');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error getting Google access token:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (userAttributes) {
|
||||||
|
getGoogleAccessToken();
|
||||||
|
}
|
||||||
|
}, [userAttributes]);
|
||||||
|
|
||||||
const handleLinkPress = (url: string) => {
|
const handleLinkPress = (url: string) => {
|
||||||
Linking.openURL(url);
|
Linking.openURL(url);
|
||||||
};
|
};
|
||||||
@@ -22,10 +109,13 @@ const SettingsScreen: React.FC = () => {
|
|||||||
{userAttributes ? (
|
{userAttributes ? (
|
||||||
<View>
|
<View>
|
||||||
<Text style={styles.userName}>Hello, {userAttributes?.name}</Text>
|
<Text style={styles.userName}>Hello, {userAttributes?.name}</Text>
|
||||||
|
{googleAccessToken && (
|
||||||
|
<Text>Google Access Token: {googleAccessToken.substring(0, 10)}...</Text>
|
||||||
|
)}
|
||||||
<SignOutButton />
|
<SignOutButton />
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<TouchableOpacity style={styles.loginButton}>
|
<TouchableOpacity style={styles.loginButton} onPress={handleSignInWithRedirect}>
|
||||||
<Text style={styles.loginButtonText}>Log In</Text>
|
<Text style={styles.loginButtonText}>Log In</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user