How to use the @aws-amplify/core.Signer.signUrl function in @aws-amplify/core

To help you get started, we’ve selected a few @aws-amplify/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-js / packages / xr / src / Providers / SumerianProvider.ts View on Github external
const scene = this.getScene(sceneParameters.sceneName);
    if (!scene.sceneConfig) {
      const errorMsg = "No scene config configured for scene: " + sceneParameters.sceneName;
      logger.error(errorMsg);
      throw(new XRSceneLoadFailure(errorMsg));
    }

    const credentials = await Credentials.get();
    const accessInfo = {
      secret_key: credentials.secretAccessKey,
      access_key: credentials.accessKeyId,
      session_token: credentials.sessionToken,
    }
    
    const serviceInfo = { region: this.options.region, service: SUMERIAN_SERVICE_NAME };
    const signedUrl = Signer.signUrl(scene.sceneConfig.url, accessInfo, serviceInfo);

    const apiResponse = await fetch(signedUrl);
    const apiResponseJson = await apiResponse.json();
    
    const sceneId = scene.sceneConfig.sceneId;
    const sceneBundle = await fetch(apiResponseJson.bundleData[sceneId].url, apiResponseJson.bundleData[sceneId].headers);
    const sceneBundleJson = await sceneBundle.json();

    try {
      // Create the scene loading script from the code embedded in the bundle.
      await this.loadScript(sceneBundleJson[sceneId].bootstrapperUrl);
    } catch(error) {
      logger.error(error);
      throw(new XRSceneLoadFailure(error));
    }
github aws-amplify / amplify-js / packages / analytics / src / Providers / AWSPinpointProvider.ts View on Github external
session_token: this._config.credentials.sessionToken,
		};

		const url = `https://pinpoint.${region}.amazonaws.com/v1/apps/${ApplicationId}/events/legacy`;
		const body = JSON.stringify(EventsRequest);
		const method = 'POST';

		const request = {
			url,
			body,
			method,
		};

		const serviceInfo = { region, service: MOBILE_SERVICE_NAME };

		const requestUrl: string = Signer.signUrl(
			request,
			accessInfo,
			serviceInfo,
			null
		);

		const success: boolean = navigator.sendBeacon(requestUrl, body);

		if (success) {
			return handlers.resolve('sendBeacon success');
		}
		return handlers.reject('sendBeacon failure');
	}
github aws-amplify / amplify-js / packages / predictions / src / Providers / AmazonAIConvertPredictionsProvider.ts View on Github external
private generateTranscribeUrl({ credentials, region, languageCode }): string {
        const url = [`wss://transcribestreaming.${region}.amazonaws.com:8443`,
            '/stream-transcription-websocket?',
            `media-encoding=pcm&`,
            `sample-rate=16000&`,
        `language-code=${languageCode}`]
            .join('');

        const signedUrl = Signer.signUrl(url, credentials, { region, service: 'transcribe' }, 300);

        return signedUrl;
    }