Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7538523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:08:32+00:00 2026-05-30T07:08:32+00:00

Is it kosher to render authentication credentials into a javascript SDK from server-side code?

  • 0

Is it kosher to render authentication credentials into a javascript SDK from server-side code?

For instance, in Django templating, it might look like:

<script type="text/javascript">
    sdk = Sdk();
    sdk_username = "{{ users_sdk_username }}";
    sdk_password = "{{ users_sdk_password }}";
    sdk.connect(sdk_username, sdk_password);
</script>

It feels a little bit sketchy, but I’m not sure how to authenticate the javascript SDK on the server and pass a token to the client.

The username and password are things the current user of the webpage should know anyways, but not something that should be generally public.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:08:33+00:00Added an answer on May 30, 2026 at 7:08 am

    Really I think a more basic problem is that you’re storing passwords in a way that they can be recovered. For many years now, it’s been considered a much better practice to store a hash of the password, combined with a “salt” value.

    The idea is that you:

    1. Take the user password supplied when it’s established through some initial registration or a “change your password” facility, and add to it some number of random bytes (the “salt”);
    2. Put the random bytes and the user password through a crytographically-secure hash function; check current literature to see what to use (SHA-1? I don’t know what’s the best as of now, Feb 2012). Then, store the hashed password plus the random “salt” bytes in the database. The salt bytes should be in plain text; their job is to make a “rainbow table” of zillions of possible passwords less practicable.
    3. To check a user password when authenticating, prepend (or append, as appropriate) the user’s saved salt value (accessed by claimed user name) to the supplied alleged password, and apply the same hash function. If the hash result matches the stored hash, then the user has supplied the right password.

    I’m not a cryptography expert, so I would encourage you (or anyone reading this) to do more research into latest techniques and best practices. For example, in recent years some interesting attacks against these schemes have been concocted, involving some timing of operations. Thus, it may be best now to make sure that your response to failed (and possibly successful!) passwords involve some random delay. Even that might be at issue if your attacker could (for a maybe wildly imaginative example) monitor power consumption of your servers! It’s a scary world.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my timer code set up, and it's all kosher, but I want
When I render XML with an :include clause for a polymorphic association I have,
Is it still not kosher to have a https page with images that are
I noticed while reading through my code that I have a static member function
Can I lock MyClass from ThreadRunner.RunThread when sending it as an argument? MyClass{ private
I'm trying to download an image from a url. The process I wrote works
I currently have a script which will pull in image contents from a database
I was writing some C# code recursively walking the referenced assemblies of a base
Is the following kosher? schema.rb users id:int (autoincr.) uid:string <---------------- ... fb_friends id:int (autoincr.)
I'm trying to use JAXB to pull some elements from a large XML file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.