Xperez
(Xabier Pérez Fernández)
July 22, 2020, 4:21pm
1
Hi
Can i create/register a user in Open Edx from an external domain? Is this possible? I mean, create it in one click, retrieving data from a form.
I have tested the creation using mysql externally already and it works, but i want something more elegant.
I have seen a post in StackOverflow that recommend using user_api/v1/account/registration/ url and a POST method, can anyone confirm this? Link to the post related
Thanks a lot
johnnyak
(Johnny Khawand)
July 23, 2020, 7:22am
2
Hi,
Try the following
Create the applications at: https://lms_domain_name/admin/oauth2_provider/application/
Client 1:
Client ID: [generated client id]
Client Type: Confidential
Authorization grant type: Authorization Code
Client Secret: [generated client secret]
Client 2:
Client ID: [generate client id]
Client Type: Confidential
Authorization grant type: Client Credentials
Client Secret: [generated client secret]
API Endpoints:
Access Token:
User Registration:
Login
johnnyak
(Johnny Khawand)
July 23, 2020, 7:26am
3
Also don’t forget to change configuration as follows:
In edx/app/edxapp/lms.env.json file:
“FEATURES” : {
…
“ENABLE_OAUTH2_PROVIDER”: true,
“ENABLE_COMBINED_LOGIN_REGISTRATION”: true
}
hi @johnnyak
I created my own login system using your instruction, yes it works and push the data
name
username
password
terms_of_service=true
honor_code=true
country=PH
email
from user admin studio
but I want is after registering it should be auto redirect to learner-dashboard
do you have any suggestion about that ?
the error I encountered
Access to XMLHttpRequest at ‘https://domain/learner-dashboard/ ’ (redirected from ‘https://localhost:44391/Home/Register ’) from origin ‘https://localhost:44391 ’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.Understand this error
angular.js:14642 Possibly unhandled rejection: {“data”:null,“status”:-1,“config”:{“method”:“POST”,“transformRequest”:[null],“transformResponse”:[null],“jsonpCallbackParam”:“callback”,“url”:“https://localhost:44391/Home/Register",“data”:{“username”:“juandelacruz”,“email”:“juandelacruz@gmail.com”,“password”:“qwerty”,“name”:"Juan Dela Cruz”,“language”:“”,“location”:“”},“headers”:{“Content-Type”:“application/json”,“Access-Control-Allow-Methods”:“*”,“Access-Control-Allow-Credentials”:true,“Accept”:“application/json, text/plain, / ”}},“statusText”:“”}
(anonymous) @ angular.js:14642
(anonymous) @ angular.js:11102
processChecks @ angular.js:17028
$digest @ angular.js:18182
$apply @ angular.js:18480
done @ angular.js:12501
completeRequest @ angular.js:12727
requestError @ angular.js:12665
error (async)
(anonymous) @ angular.js:12668
sendReq @ angular.js:12446
serverRequest @ angular.js:12198
processQueue @ angular.js:17000
(anonymous) @ angular.js:17044
$digest @ angular.js:18182
$apply @ angular.js:18480
(anonymous) @ angular.js:27290
dispatch @ jquery-3.4.1.js:5237
elemData.handle @ jquery-3.4.1.js:5044Understand this error
angular.js:12701
GET https://domain/learner-dashboard/ net::ERR_FAILED