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 6028035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:40:45+00:00 2026-05-23T04:40:45+00:00

I have an api which uses OAuth 1.0a to authenticate applications using it. It’s

  • 0

I have an api which uses OAuth 1.0a to authenticate applications using it. It’s replacing an old api which used a number of custom built and hodge-podge calls which are being deprecated.

It’s well known that OAuth 1.0a is not secure in (client-side) Javascript since it relies on the consumer secret being kept secret. Which is not possible since the source is always viewable.

We have browser extensions for Chrome, Firefox, IE and Safari which need to use this api in the future. These extensions are all written largely or entirely in Javascript, and hence the problem of security.

These extensions are in-house and so can have custom authentication methods to get their access tokens.

What I’m planning on implementing is the following:

  • The user logs into the website in the browser.
  • The website issues them a cookie with a session key.
  • Our extension then takes that cookie and passes it to the api.
  • The api validates that it is a valid & active session and issues the extension its access tokens.
  • These tokens last for a maximum of one hour before they expire.
  • There will also be lower rate limits on the javascript issued cookies.

It operates under the following assumptions:

  • If another application has access to your cookies, then they can impersonate you on the website anyway, so access to the api is no different.
  • All authentication methods still go through our control.
  • Regular expiry of tokens means that if they are compromised then there is a limited time for exploitation.

My question is, is this a secure method of restricting access to the api?
Are there any better ones?

A couple of notes.
I know for a fact that chrome extensions can ask for permission to access your cookies for a given site. I believe firefox extensions can do so too.

Obviously we don’t want our cookies accessible via javascript on any page otherwise we’d expose ourselves to XSS attacks, so they need to only be accessible via extensions.

  • 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-23T04:40:46+00:00Added an answer on May 23, 2026 at 4:40 am

    I wrote a site that does OAuth login via javascript library for OAuth. This is the workflow:

    1. OAuth is only supported on browsers that have LocalStorage
    2. The login form will check LocalStorage for OAuth keys and try an OAuth login automatically if OAuth keys exist.
    3. There is a checkbox for “remember me” on login form, so a user can have OAuth tokens created for them on login.
    4. A successful login w/ remember me will:
      • find or create ClientApplication with the name equal to User Agent, and create the tokens if necessary
      • respond with a javascript tag in the HTML response. The javascript tag will call a javascript function with the tokens passed as arguments. This function will save the OAuth tokens to LocalStorage.
    5. An unsuccessful OAuth login attempt will:
      • respond with a javascript tag in the HTML response. The javascript tag will call a javascript function to clear the LocalStorage settings for OAuth tokens. This will prevent additional OAuth login attempts

    There is some more detail to this process, I can tell you more about it if you want me to.

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

Sidebar

Related Questions

We're trying to connect with another company's custom API which uses two-legged OAuth to
HI i have an old code which uses a scrapref and selects scrap using
I have a small Python program, which uses a Google Maps API secret key.
Is it possible to have a C static library API, which uses C++ internally
I have a web site with an API which publishes the information using JSON.
I have a process in c++ in which I am using window API. I
I have a class API which has full code coverage and uses DI to
I'm working on the development of a C++ API which uses custom-designed plugins to
I have an ASP.NET 4.0 web application which uses a third-party API for external
I have a project which uses the windows API on windows, and pthreads on

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.