aws-lambda-token-fetcher

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2018 License: MIT Imports: 3 Imported by: 0

README

AWS Lambda token fetcher

Small lambda written in Golang and used to get viewables:read 2-legged tokens, which in conjunction with AWS API Gateway creates the minimal backend needed for serving to Forge Viewer the access tokens.

Setup

  1. create a deployment package following the AWS guide or create a new lambda through AWS portal and upload the zip file (either prepared by you or downloaded from releases)(A).
  2. Set the environment variables with your Autodesk Forge credentials (as shown in bellow at B).



3. Through AWS portal, in API Gateway, create a new API, set the integration type as lambda and specify the AWS lambda created at step 1.


4. Use the endpoint created by the API Gateway, in your apps to get the viewables:read tokens, used by viewer to display your models:

    let options = {
        env: 'AutodeskProduction',
        getAccessToken: (onGetAccessToken) => {
            fetch('https://9irt90dm6j.execute-api.us-east-1.amazonaws.com/prod')
                .then(response => response.json())
                .then(data => {
                    let accessToken = data["access_token"];
                    let expireTimeSeconds = data["expires_in"];
                    onGetAccessToken(accessToken, expireTimeSeconds);
                })
        }
    };

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL