Jump to content

Create federated user with REST API


Go to solution Solved by Carl Zeiss GOM Metrology,

Recommended Posts

Posted (edited)

Hey,

I should migrate users and posts from one forum to invision community. Therefore I prepare the topic / post migration with migrating all users before. I use REST API with HTTP POST to /core/members for that. But we do not have local users (and the new users should also not be local) but we have an oAuth integration.

If I create the user without a password, the user will be mapped correctly on his first sign in to the correct user account, but is forwarded to https://my.url/settings/password/?ref=aHR0cHM6Ly90ZXN0LXF1YWxpdHlmb3J1bS56ZWlzcy5vcmcvdGCCCCCCCCCCCCXNzLW1ldHJvbG9neXXXXXX9taW5nLXNvb24v which will lead to an error message: "The page you are trying to access is not available for your account!" - I think because user is linked to oAuth and password is disabled? The user cannot move to any other site and will be always forwarded to the /settings/password/ page with the error message.

If I create the user with a default password, the user will also be mapped correctly on first sign in but the user has to insert the default password to confirm the linkage. In my migration scenario: I do not want the user to get a password nor to force the user to confirm a password there.

My wish is: I want to create the user accounts as finished as I can with REST, so I can migrate all posts and topics (and maybe user settings) and the user is ready to start usage of invision community without having efforts on linking or something like that. Is there a way to do so?

My POST is currently like:
https://my.url/api/core/members?key=<myKey>&name=<username>&email=<user_mail>&group=3&validated=1&rawProperties[joined]=<unix_timestamp_from_other_forum> 
Am I missing some property?

Edited by Carl Zeiss GOM Metrology
  • Solution
Posted

Okay, I found a way.

I created two sql dumps before and after the "confirm your password" stuff and created a diff. I saw some entry added to 'core_login_links'. So I tried adding the entry by my own.

After I create the user with a password with HTTP POST, I get the member_id back and write following directly to database:

INSERT INTO `core_login_links` VALUES (<myLoginMethodId>,<member_id>,'<myExternalIDPuserid>',1,'',0,NULL,NULL,'[\"<myIDPaudience>\",\"openid\"]',NULL);

This prepares the user, so he can join with my created user account, without any efforts. Maybe it is also possible to do that with REST API, but currently it is working for me.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...