Comments (5)
Thank you for your response.
cognitoUser.getUserAttributes(function(err, result) {
if (err) {
alert(err.message || JSON.stringify(err));
return;
}
for (i = 0; i < result.length; i++) {
console.log(
'attribute ' + result[i].getName() + ' has value ' + result[i].getValue()
);
}
});
quoted from https://www.npmjs.com/package/amazon-cognito-identity-js, use case 5
I want to do the above kind of things to get user attribute, 'preferred_username'.
So I want to get a cognitoUser or equivalent from useAuth().
Is there any way to accomplish that?
from aws-cognito-next.
I managed to solve my problem!
And I found a better way to accomplish that.
If Auth is configured to request profile scope, idTokenData becomes to have preferred_name and other user attributes.
Finally I used it to solve the problem.
Your advice was very helpful to solve the problem.
Thank you!
from aws-cognito-next.
Can you show how you'd do it without this library? I'm not sure which attributes you're talking about.
Note that official support for Next.js from AWS itself is on the way (see #4, and aws-amplify/amplify-js#5435).
At the moment I'm waiting for that to land before deciding the future steps and role of aws-cognito-next
, so I doubt I'll add any functionality at the moment.
(sorry, closed this issue by accident)
from aws-cognito-next.
I dug around and it seems like that function is using their API (https://github.com/aws-amplify/amplify-js/blob/794c1da170cd98d3def4651751b851f28810bb6e/packages/amazon-cognito-identity-js/src/CognitoUser.js#L1151-L1181). This seems like something you could build yourself.
I haven't actively used this package since first publishing it since the project I built it for got delayed. So my memory of this package is a bit faded. You might be able to do this more easily once the official Next.js support is released (aws-amplify/amplify-js#5435).
I'm sorry I'm not more helpful. This package is in a weird state as I'm awaiting the official release so the direction this package is headed becomes clearer.
from aws-cognito-next.
Awesome :) Wish I could have pointed you in that direction right away. I'll know for next time!
from aws-cognito-next.
Related Issues (8)
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 aws-cognito-next.