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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:15:11+00:00 2026-05-29T10:15:11+00:00

I am implementing a restful api and I wondering is it possible to securely

  • 0

I am implementing a restful api and I wondering is it possible to securely authenticate using ajax without exposing the authenentication credientials? The credentials that will be used are the same ways that will be passed using curls:

curl_setopt($ch, CURLOPT_USERPWD, 'username:password');

The will be received using:

$_SERVER['PHP_AUTH_USER']
$_SERVER['PHP_AUTH_USER'];
$_SERVER['PHP_AUTH_PW'];

Is this possible and if so, how?

  • 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-29T10:15:11+00:00Added an answer on May 29, 2026 at 10:15 am

    No. This is the exact purpose and use case for implementing Oauth.

    Using Basic HTTP Authorization will expose the credentials especially from ajax, because even if you run everything through HTTPS, it will still be available in the client code (before any request is made).

    If you are using this api internally only (not expecting third party developers to utilize it), you might attempt to use a “API Key” instead of the plain text username and password. This way the key can be regenerated if ever compromised, and never expose your users (likely) reused passwords.

    I’ve found that API key + HTTPS covers a lot of situations like this.

    You just generate a unique hash and then use that to authenticate the user… the Basecamp API uses the API key as the username.

    curl_setopt($ch, CURLOPT_USERPWD, '<API KEY>:x');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently implementing a RESTful API (nothing serious, just for a blog engine i'm
implementing publishActivity in PHP using the REST API using this code: $activity = array(
My goal is to define a RESTful api using CherryPy (wsgi) + uWSGI +
I'm developing a RESTful API for a client. The problem is, he's using a
I've been attempting to architect a server side API that runs using a noSQL
I'm working on implementing a RESTful API resource architecture in my micro-framework. I'm modeling
I'm implementing a RESTful API which exposes Orders as a resource and supports pagination
I'm implementing a generic restful api in WCF. I require access to a generic
I am exploring the idea of implementing a web service api using WCF Data
The scenario is: I'm implementing a RESTful web-service that will act as a cache

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.