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
1 Like
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
3 Likes
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
}
2 Likes
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