Jeff Tian
Jeff Tian

Reputation: 5913

How to use my wordpress site as an OAuth server?

I have an app, and I want enable users log in to the app using my wordpress site's user info. So the user clicks on the sign in button, a new window popsup and opened by wordpress site. And after user input the username and password of my wordpress site, then the user should log in to the mobile app.

So I need my wordpress site behaves like an OAuth server, how could I achieve it, and how to invoke the the OAuth apis?

Upvotes: 1

Views: 236

Answers (2)

Lana Codes
Lana Codes

Reputation: 404

If you want to use WordPress website authentication and users in your application, you need an OAuth server on your WordPress website. This is our product: https://lana.codes/product/lana-passport/

If the user clicks the Single Sign On button (and is not logged in to the WordPress site), the WordPress login interface will appear where the user can authenticate.

Once you have the authentication, you have access to the /resource endpoint, which returns user data according to the scope.

Note: you have to create a Single Sign On solution for your app (it will be an OAuth client), which is connected to the endpoints of the WordPress OAuth server.

So in summary:

  • the WordPress website needs an OAuth server
  • the app needs an OAuth client

Upvotes: 1

rajaishwary
rajaishwary

Reputation: 5082

You need to use WP OAuth server in your Wordpress website and additionally a plugin that enables APIs for your Wordpress site.

For OAuth server plugin, Check below link: https://wordpress.org/plugins/oauth2-provider/

It works with WP REST API/ JSON API and provides access protected endpoints via OAuth2.

Upvotes: 1

Related Questions