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

  • SEARCH
  • Home
  • 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 4266566
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:46:40+00:00 2026-05-21T06:46:40+00:00

I am building a JavaScript SDK for our API. The API currently requires (2-legged)

  • 0

I am building a JavaScript SDK for our API. The API currently requires (2-legged) OAuth authentication. Obviously this isn’t suitable for a JS SDK since the key and secret are in plain site (in the JS code).

Facebook only requires your app id when you init their JS SDK, so I would like to implement something similar (or of similar simplicity). When a developer requests a key we require their app’s domain. I was thinking of detecting the IP address of the submitted domain (for example myclientapp.com has 192.168.0.0 IP). And then authenticating JavaScript requests by confirming the remote hosts IP address matches.

Is this the best/easiest way of doing this?

UPDATE: As Rup pointed out the remote IP will be the client and thus not match the apps URL’s IP. So that’s out. So to reiterate I’m looking for a solution that will allow me to enforce some form of authentication in my JavaScript sdk for my API that can’t be spoofed by someone else (trying to be someone elses app).

Thanks,

Gavin

  • 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-21T06:46:41+00:00Added an answer on May 21, 2026 at 6:46 am

    Authenticate the user instead.

    Have the (claimed, but untrustworthy) app id passed into your init(), jsonp out to your domain, then either:

    • Return a code valid for making API requests with, if the user is logged in* and has already authorized the app.
    • Pop up a window to your site (or redirect, or whatever) to have the user login (if needed) and authorize the app.

    You’ll have control of the user experience during authentication, and can do some human verification of the app id (show the claimed logo, name, etc.).

    This does assume that you even have a notion of users, like Facebook does.

    *Check cookies, not all browsers accept them in response to ajax requests; but all browsers will send them.

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

Sidebar

Related Questions

I'm working on building a development tool that is written in JavaScript. This will
I am building a Facebook App which is heavy on Javascript. For this I
I'm currently building a small web application that includes a fair amount of JavaScript.
I got the following Request Queue implementation from this blog: http://dsgdev.wordpress.com/2006/10/28/building-a-javascript-http-request-queue/ and want to
I have been using PHP and JavaScript for building my dad's website. He wants
I am building an application where most of the HTML is built using javascript.
Browsing the Internet, I found the new Ample SDK JavaScript framework. From their about
I'm building a Javascript preview function for a blog back-end (much like the one
I'm building a JavaScript library for customers to use to embed content my company's
I'm building a JavaScript engine. I used a simple function as a class, added

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.