amazon-cognito-passwordless-auth icon indicating copy to clipboard operation
amazon-cognito-passwordless-auth copied to clipboard

Can we load logo from assets folder locally

Open cordev-developer opened this issue 1 year ago • 4 comments

Hi guys,

Hope you are doing well. Lastly I've been working with the React Example with FIDO2, especifically I have one doubt about why we need to load the logo from our brand with a URL, I wonder if maybe is there a possibility to load our brand logo from local folder in Visual Studio Code. I refer to this part of code in which we see the logo URL, maybe is it possible ?:

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( <PasswordlessContextProvider enableLocalUserCache={true}> <PasswordlessComponent brand={{ backgroundImageUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Manhattan_in_the_distance_%28Unsplash%29.jpg/2880px-Manhattan_in_the_distance_%28Unsplash%29.jpg", customerName: "Amazon Web Services", customerLogoUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Amazon_Web_Services_Logo.svg/1280px-Amazon_Web_Services_Logo.svg.png", }} > <React.StrictMode> <App /> </React.StrictMode> </PasswordlessComponent> <Fido2Toast /> {/* Add Fido2Toast below App so it is rendered on top */} </PasswordlessContextProvider> );

cordev-developer avatar Jul 23 '24 00:07 cordev-developer

Hi mate. Not sure would have to experiment. Wouldn't be surprised if this would just work:

import backgroundImageUrl from "./path1/backgroundImage.png";
import customerLogoUrl from "./path2/logo.png";

<PasswordlessComponent brand={{backgroundImageUrl, customerName: "Your company", customerLogoUrl}}>

Because afaik Vite resolves such imports to a path.

Suggest to check out Vite docs: https://vitejs.dev/guide/assets

ottokruse avatar Jul 23 '24 08:07 ottokruse

Wow !!

Amazing, job done !, your code works well, as you can see I have to update my knowledge about JS, but I will do it. Ey ottokruse, I saw your profile in Github, now I'm your follower jeje. I wonder if I can tell you some doubts about this FIDO2 example since I've been working in a Cognito course published in Udemy and in a online academy of my friend. My intention is to traslate the course to English (is not a problem, I've the B2 level) since both course were published in Spanish for the moment. You can check it at: Spanish Cognito Course, in this particular course I have not published this FIDO2 example, but in the online academy of my friend I have published this example, but I want to add more classes about how to implement the example with React and Amplify hence I have had these questions.

As I saw you work as AWS Engineer and maybe you work with Cognito and/or authentication department, and I thought if I can write some mail to your email of your Github profile if I found some difficult questions about this FIDO2 example, or if you want I will ask you in this Github issues. Also, I've suscribed to AWS support since it is a complex topic and it has taken me two years to prepare the Udemy course (combined with a master's degree and other little personal projects). Thanks in advance !!

Have an awesome day ahead.

cordev-developer avatar Jul 23 '24 18:07 cordev-developer

Hi mate. Sure feel free to email me (you can find my email in my commits ;)) However if you have non-sensitive questions that would help others as well to know the answer to, please just use a GitHub issue (best: a new issue for each question).

GREAT WORK you're doing, thank you for spreading Cognito knowledge!

ottokruse avatar Jul 24 '24 07:07 ottokruse

Hi ottokruse, ok great ! I will follow your recommendations, I thought it's a great idea to share the questions with other mates. I will continue with my new section about Passkeys and FIDO2, thanks a lot !

Have an awesome day ahead.

cordev-developer avatar Jul 26 '24 07:07 cordev-developer