Auth0 Home Blog Docs

Using oauth with HTML website

oauth
html5mode

#1

I have created a single page HTML website and would like the user to use oauth in order to log in to the website before they can view any features.
I have created a test app on the Auth0 site but can’t figure out how to implement it with my website.

Any ideas?
Thanks!


#2

@charlotte.summers the short answer is this is possible, but depending on the tech stack and what you want to accomplish. I have a few questions:

Is this HTML website a truly static site like something that would be generated by jekyl or gatsby? In otherwords is this site eventually just some static website without any API calls? If so, what are you trying to accomplish with OAuth?

Is this an HTML website that has some dynamic components that are sending XHRs to fetch data? If so then you could follow our vanilla javascript quickstarts to get some ideas on how to accomplish fetching data with an access_token.


#3

I’m not familiar with Jekyl or gatsby. But if my understanding of what you mean by static is correct then yes - nothing external is going to impact the layout/content of the website once it’s live (other than version updates on my end).

I was told a requirement was to have a login system and OAuth was recommended. The purpose of OAuth was to allow only people with an @companyName.com email address access the information on the page. I’ve figured this part using the email domain whitelist rule.
There is also an HTML form in one tab that uses PHP to send the form data to a MySQL database.

Sorry if my answers aren’t what you’re looking for I’m new to this… please do let me know if I haven’t answered them properly.