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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:34:30+00:00 2026-06-02T11:34:30+00:00

I am writing an API to be used by both my JavaScript app (same

  • 0

I am writing an API to be used by both my JavaScript app (same domain, API is at api.example.com and site at example.com and 3rd party developers (mobile, desktop, etc). Now I want to use OAuth but I have no idea how the workflow is when using both OAuth and using my application with the same origin policy.

How do I authenticate the user in my web app? When I send the username and password, can I check if the request came from my domain and then return the token? The token will be stored in a cookie and sent back to the server on every request. So there are 2 parts:

  1. If the request came from my domain, just check for token else throw HTTP exception.
  2. If not my domain, do OAuth authentication.

Is this possible? How do I go about setting this up in asp.net web API? (mainly the part about checking if the request is in the same domain)

  • 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-06-02T11:34:33+00:00Added an answer on June 2, 2026 at 11:34 am

    I am guessing that to log into your web app you’re not using OAuth, but simply accept username and password and start a session? If so you don’t really have to bother with OAuth for your own site.

    Set up the session cookie to be valid across *.example.com and you should be able to validate that cookie both on site.example.com and api.example.com.

    Example:

    1. Request comes in to api.example.com/verify_credentials.json
    2. Serve response if OAuth validation is successful.
    3. If not, attempt Cookie validation – serve if successful
    4. Return 402 Unauthorized if both fail.

    Here’s a thread about sharing a cookie across sub domains: ASP.NET Subdomain Cookie (parent and one subdomain)

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

Sidebar

Related Questions

Can anyone suggest a pattern that can be used for writing a JavaScript API
I am working on a REST API that will be used by developers writing
I'm writing an API on Android that will be used by an existing application,
We are writing an API for iphone developers and we don't know what the
I am working on a REST API to be used by a mobile application
I'm writing an API which is used to receive some data from another application.
I am writing a server used ASP.NET Web Api template and implementing rest services.
I'm writing a Stack Overflow API wrapper , currently at http://soapidotnet.googlecode.com/ . I have
I'm writing a API to be used in the creation of Interfaces at work.
I am writing a code, trying to get used to the C API of

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.