Comments (13)
We cannot give the exact timeline for this but it the service will be generally available very soon.
from amazon-cognito-identity-js.
Edit:
Do not use any more. this was changed by #108, see example config there or doc update PR #117
Original
Here was my stab at it, not sure if it's all necessary:
// webpack.config.babel.js
import {ProvidePlugin} from 'webpack';
const AWS_SDK_MAIN = 'aws-sdk/dist/aws-sdk.min';
const AWS_COGNITO_SDK_MAIN = 'amazon-cognito-identity-js/dist/aws-cognito-sdk.min.js';
const AMAZON_COGNITO_IDENTITY_MAIN = 'amazon-cognito-identity-js/dist/amazon-cognito-identity.min.js';
export default {
resolve: {
alias: {
'aws-sdk$': AWS_SDK_MAIN,
'aws-cognito-sdk$': AWS_COGNITO_SDK_MAIN,
'amazon-cognito-identity-js$': AMAZON_COGNITO_IDENTITY_MAIN,
},
},
<snip normal entry, output>
plugins: [
new ProvidePlugin({
AWS: AWS_SDK_MAIN,
AWSCognito: AWS_COGNITO_SDK_MAIN,
}),
],
module: {
noParse: [
/aws-sdk/,
/aws-cognito-sdk/,
],
loaders: [
{
test: require.resolve(AWS_SDK_MAIN),
loader: 'exports?AWS',
},
{
test: require.resolve(AWS_COGNITO_SDK_MAIN),
loader: 'exports?AWSCognito',
},
{
test: require.resolve(AMAZON_COGNITO_IDENTITY_MAIN),
loader: 'imports?jsbn,BigInteger=>jsbn.BigInteger,sjcl,dummy=sjcl/core/codecBytes,moment',
},
{
test: require.resolve('sjcl/core/codecBytes'),
loader: 'imports?sjcl',
},
<snip my code>
],
},
devtool: 'source-map'
};
from amazon-cognito-identity-js.
Making this lib work with webpack is a real nightmare !!
I lose so much time trying to do this ...
from amazon-cognito-identity-js.
@lauterry I did the same thing as mike and just included the scripts in my root index.html file. Then made a resources folder with jsbn.js, jsbn2.js, moment.js, and all other dependencies rather than installing them with npm install. It is a sloppy way of doing things but it was the only way to get things working with webpack.
from amazon-cognito-identity-js.
You should be able to reference jsbn prior to amazon-cognito-identity.min.js amazon-cognito-identity does not include any of the dependencies.
from amazon-cognito-identity-js.
Hi
In fact it is jsbn2 which need to be imported after jsbn because jsbn2 needs BigInteger.
For my part, I have the following error
jsbn2.js?f193**:597Uncaught ReferenceError: BigInteger is not defined
from amazon-cognito-identity-js.
I caved in and just included the scripts in the html file. Not worth the
hassle of getting it to work with webpack. Hopefully this is resolved once
it comes out of beta
On Thursday, June 2, 2016, LAU Thierry [email protected] wrote:
Hi
In fact it is jsbn2 which need to be imported after jsbn because jsbn2
needs BigInteger.For my part, I have the following error
jsbn2.js?f193**:597Uncaught ReferenceError: BigInteger is not defined
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#48 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AABnnlvrGyua4FqDuXyTSVHU3YwFwnmuks5qH0vLgaJpZM4IpTkN
.
Sent from Gmail Mobile
from amazon-cognito-identity-js.
I finally got it working.
You can have Webpack append export details to the end of a file. This is useful for javascript libraries that weren't designed as modules. Using the exports-loader, we can expose specific variables/functions for the require
process.
You'll need the imports-loader and exports-loader.
npm install imports-loader
npm install exports-loader
In your main entry point JS file (i.e.: main.js), you'll need to declare the results of the require
in the global scope for the imports-loader to be able to reference them.
// In your main entry point js file.
// webpack.config.js is configured to export a series of variables that we'll also import into jsbn2 and the AWS SDK.
JsbnWrapper = require("./js/lib/utils/jsbn.js");
// Webpack.config.js will import variables into this file that were exported from jsbn.js.
require('./js/lib/utils/jsbn2.js');
// Set "sjcl" to the global scope.
sjcl = require('sjcl');
require('./node_modules/amazon-cognito-identity-js/dist/aws-cognito-sdk.min.js');
require('./node_modules/amazon-cognito-identity-js/dist/amazon-cognito-identity.min.js');
In your webpack.config.js
file, you'll need to add the imports and exports settings for the jsbn, jsbn2, and amazon cognito files.
/* ...
Your webpack.config.js specific settings.
.... */
module.exports = {
/* ... */
module: {
loaders: [
{
test: /jsbn\.js$/,
loaders: [
'exports?BigInteger=BigInteger',
'exports?IntAt=intAt',
'exports?Nbv=nbv',
'exports?Montgomery=Montgomery',
'exports?Nbi=nbi',
'exports?Nbits=nbits'
]
},
{
test: /jsbn2\.js$/,
loaders: [
'imports?BigInteger=>JsbnWrapper.BigInteger',
'imports?nbi=>JsbnWrapper.Nbi',
'imports?intAt=>JsbnWrapper.IntAt',
'imports?nbv=>JsbnWrapper.Nbv',
'imports?Montgomery=>JsbnWrapper.Montgomery',
'imports?nbits=>JsbnWrapper.Nbits'
]
},
{
test: /amazon-cognito-identity\.min\.js$/,
loaders: [
'imports?BigInteger=>JsbnWrapper.BigInteger'
]
}
]
}
};
from amazon-cognito-identity-js.
It would be great if the AWS team could let us know when they think this will come out of beta before spending a few hours working on this approach.
On Sun, Jun 19, 2016 at 4:25 PM Brian Young
<
mailto:Brian Young [email protected]
wrote:
I finally got it working.
You can have Webpack append export details to the end of a file. This is useful for javascript libraries that weren't designed as modules. Using the exports-loader, we can expose specific variables/functions for the
require
process.
You'll need the
https://github.com/webpack/exports-loader
and
https://github.com/webpack/imports-loader
.
npm install imports-loader
npm install exports-loader
In your main entry point JS file (i.e.: main.js), you'll need to declare the results of the
require
in the global scope for the imports-loader to be able to reference them.
// In your main entry point js file.
// webpack.config.js is configured to export a series of variables that we'll also import into jsbn2 and the AWS SDK.
JsbnWrapper
require
(
"
./js/lib/utils/jsbn.js
"
);
// Webpack.config.js will import variables into this file that were exported from jsbn.js.
require
(
'
./js/lib/utils/jsbn2.js
'
);
// Set "sjcl" to the global scope.
sjcl
require
(
'
sjcl
'
);
require
(
'
./node_modules/amazon-cognito-identity-js/dist/aws-cognito-sdk.min.js
'
);
require
(
'
./node_modules/amazon-cognito-identity-js/dist/amazon-cognito-identity.min.js
'
);
In your
webpack.config.js
file, you'll need to add the imports and exports settings for the jsbn, jsbn2, and amazon cognito files.
/* ...
Your webpack.config.js specific settings.
.... */
module
.
exports
{
/* ... */
module
:
{ loaders
:
[ { test
:
/
jsbn
.
js
$
/
, loaders
:
[
'
exports?BigInteger=BigInteger
'
,
'
exports?IntAt=intAt
'
,
'
exports?Nbv=nbv
'
,
'
exports?Montgomery=Montgomery
'
,
'
exports?Nbi=nbi
'
,
'
exports?Nbits=nbits
'
] }, { test
:
/
jsbn2
.
js
$
/
, loaders
:
[
'
imports?BigInteger=>JsbnWrapper.BigInteger
'
,
'
imports?nbi=>JsbnWrapper.Nbi
'
,
'
imports?intAt=>JsbnWrapper.IntAt
'
,
'
imports?nbv=>JsbnWrapper.Nbv
'
,
'
imports?Montgomery=>JsbnWrapper.Montgomery
'
,
'
imports?nbits=>JsbnWrapper.Nbits
'
] }, { test
:
/
amazon-cognito-identity
.
min
.
js
$
/
, loaders
:
[
'
imports?BigInteger=>JsbnWrapper.BigInteger
'
] } ] } };
—
You are receiving this because you authored the thread.
Reply to this email directly,
#48 (comment)
, or
https://github.com/notifications/unsubscribe/AABnnqjUfkHaCmGYvNN0pJBaXsFSfRe6ks5qNaXBgaJpZM4IpTkN
.
from amazon-cognito-identity-js.
Can you send a pull request for this? Thanks!
from amazon-cognito-identity-js.
my issue: window not defined
from amazon-cognito-identity-js/dist/amazon-cognito-identity.min.js
please help me!
from amazon-cognito-identity-js.
$ npm install script-loader
require("script!./jsbn.js");
require("script!./jsbn2.js");
require("script!./sjcl.js");
require("script!./aws-cognito-sdk.min.js");
require("script!./amazon-cognito-identity.min.js");
from amazon-cognito-identity-js.
thank you verry much
2016-10-11 21:48 GMT+07:00 tcleu [email protected]:
@hungcuong0105 https://github.com/hungcuong0105 Have you figured out a
solution to your issue of "window not defined"?I am encountering a similar issue with the following error:
ReferenceError: window is not defined
at e.o.value (/var/task/node_modules/amazon-cognito-identity-js/
dist/amazon-cognito-identity.min.js:19:22615)
at Response. (/var/task/node_modules/
amazon-cognito-identity-js/dist/amazon-cognito-identity.min.js:19:11223)
at Request. (/var/task/node_modules/aws-
sdk/lib/request.js:355:18)
at Request.callListeners (/var/task/node_modules/aws-
sdk/lib/sequential_executor.js:105:20)
at Request.emit (/var/task/node_modules/aws-sdk/lib/sequential_executor.
js:77:10)
at Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:668:14)
at Request.transition (/var/task/node_modules/aws-
sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/var/task/node_modules/aws-
sdk/lib/state_machine.js:14:12)
at /var/task/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/var/task/node_modules/aws-
sdk/lib/request.js:38:9)on the OnSuccess callback for cognitoUser.authenticateUser().
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#48 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATsymRh4UrC6ygxn_xbjyhiLQnN822Xbks5qy6G0gaJpZM4IpTkN
.
from amazon-cognito-identity-js.
Related Issues (20)
- Can I use my own login page in sample web page demonstrates?
- CognitoIdentityCredentials, Access Denied error, not authorized to perform iam:PassRole??? HOT 2
- AWS Cognito SDK required even if AWS SDK is already imported HOT 1
- Incompatibility with AWS SDK >=2.178.0 HOT 3
- How to use the Lambda triggers in cognito-identity-js
- InvalidAction: The action or operation requested is invalid. Verify that the action is typed correctly.
- enableMFA failing (user is not authenticated) when user is logged in HOT 2
- Need clarification on entire TOTP setup process HOT 2
- Question: With the use case 4
- Cannot reset password for the user as there is no registered/verified email or phone_number HOT 3
- Uncaught TypeError: Cannot set property 'createCredentials' of undefined HOT 2
- How can you require verification of Phone Number and Email before issuing tokens from InitiateAuth call?
- Humbly request to re-write this SDK in today's javascript standard HOT 1
- How to tell if ID & access tokens are expired? How do we refresh? HOT 2
- InvalidParameterException: TIMESTAMP format should be EEE MMM d HH:mm:ss z yyyy in english. HOT 1
- Use this library without a cognito pool, just a federated identity pool
- TypeError with AdminConfirmSignUp HOT 2
- Cookie Storage Limits on Safari HOT 1
- Refresh access and id tokens in a React/Angular SPA HOT 1
- configure refreshToken expiration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-cognito-identity-js.