Authenticate membership users from another site?

  • Jasem Mutlaq
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 week ago #112645 by Jasem Mutlaq
I need to build a special nodejs-based service (with react-redux) that is available to members who subscribe to a specific plan. This would be hosted in a different server, and I need to authenticate the users or redirect them to the membership pro subscription page. Is there a way to integrate my nodejs app with Membership Pro to allow the authentication of users there?

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
7 years 1 week ago #112649 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Authenticate membership users from another site?
Hi Jasem

While talking about authentication, I think your application should authenticate with Joomla directly (Membership Pro doesn't handle the login, it uses Joomla Login process).

To be honest, I don't have experience with nodejs (or app outside Joomla in general), but maybe the kind of plugin like this github.com/joomlatools/joomla-basicauth would be useful?

Also, I want to make it clear that as of right now, Membership Pro doesn't have a REST API (for example, allow creating subscriptions, allow getting list of subscriptions of current users...), so I am not sure if it's good to use for your project

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Jasem Mutlaq
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 week ago #112650 by Jasem Mutlaq
Replied by Jasem Mutlaq on topic Authenticate membership users from another site?
Hi Tuan,

Thank you for your fast report!

Well, I needed a component to handle subscriptions to services, but I also need a way to relay this information to a 3rd party so the user would only register once. Then once the user logs the 3rd party website, we check if the user is an active subscriber to the service, and if yes, then login is successful and the user can now use the service.

Having a REST API would be nice though to check if a particular user is an active member of a subscription.

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
7 years 1 week ago #112653 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Authenticate membership users from another site?
REST API is something I should support in the future. However, to be honest, It won't be in very near future (maybe 4 to 6 months). As of right now, I still have other features I want to focus working on first

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Jasem Mutlaq
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 week ago #112702 by Jasem Mutlaq
Replied by Jasem Mutlaq on topic Authenticate membership users from another site?
Thanks, I have a different question. I want o create a menu item to go to the plans page. However, if the user is an active subscriber, I want the same link to redirect to another URL. So if my website is www.foo.com , I want to redirect to plan.foo.com

Looking at documentation, I thought I'd use "Restrict access to URLs" plugin. However, I created a menu item with type system links --> URL (plan.foo.com), and then added plan.foo.com to restricted URLs, but that didn't work.

Then I thought because the menu link itself points to plan.foo.com it could be a problem, so I tried to create menu to a menu alias, but it looks like you can't create menu to a menu alias of type system-links URL. So how do I achieve this?

User logged in --> go to plan.foo.com
User not logged in --> go to plans page

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
7 years 1 week ago #112706 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Authenticate membership users from another site?
Hi

I am not sure (because this is an external URL). However, you can try this approach:

1. Create a menu item (external) to link to plan.foo.com

2. Edit the plan, there is a setting called Login Redirect. Select the menu item you created abiove

If it works, then you are good. Otherwise, I am afraid of we don't have a solution and you will have to customize the code. Look at plugins/system/membershippro/membershippro.php , modify code to redirect users to the URL you want if they have active subscription (method onUserAfterLogin)

Regards,

Tuan

Please Log in or Create an account to join the conversation.