If you want to generate tokens for your users for using the WPLMS API in a separate project then this could be useful.
YOUR_WPLMS_SITE_LINK/wplmoauth/authorize?client_id=YOUR_APP_ID&redirect_uri=YOUR_WPLMS_SITE_LINK&response_type=code&scope=basic&state=YOUR_APP_STATE
When you open this in the browser, it will redirect you to the WP login screen, once you login you’re redirected to a URL like this:
or a URL something like this (if you’re already logged in ):
YOUR_WPLMS_SITE_LINK/?code=AUTHORIZATION_CODE&state=YOUR_APP_STATE
Now we need to use this AUTHORIZATION_CODE to get the token for the user.
Copy the AUTHORIZATION_CODE from the URL and then create a post request :
YOUR_WPLMS_SITE_LINK/wplmoauth/token and in the body we need to POST these parameters
grant_type: ‘authorization_code’,
code:AUTHORIZATION_CODE,
client_id:YOUR_APP_ID,
client_secret:YOUR_APP_SECRET,
redirect_uri:this.YOUR_WPLMS_SITE_LINK
and you’ll get the token for the user.