Add client at /oauth2-servers/manage/oauth2/clients
Call the client discourse
Enter the same client secret as above
Set Redirect URIs as http://DISCOURSE/auth/oauth2_basic/callback where DISCOURSE = your discourse forumās base URL
Status and Known Issues:
If you follow the steps above, you should see a āwith OAuth2ā badge on the login screen. Clicking on it should redirect you to your Drupal site for login that asks āAuthorize discourse to use your account?ā Clicking āYesā results in either association to an existing account with the same email or creation of a new account with that email.
Near the top of the other thread about oauth2, I saw something related to sending the header āAuthentication: Bearer <oauth2_token>ā to the server. Maybe this is what you are looking for.
Otherwise you have to look at the code or ask the other guys about how it works, and maybe fix it.
Ok, I have success!!! However, @dashohoxha, Iām not sure how to figure out the output of user/profile in OAuth2_loginproviderā¦ Could you give me some advice?
The output should be a JSON that contains the fields of the user profile. Can you print it somewhere for debugging? I am not familiar with RoR, so I cannot help you with this.
This is related to the configuration of the Drupal module Services at /admin/structure/services/list/oauth2_login_provider/server By default all types of request and response formats are enabled, and if the HTTP request does not specify a response format, XML is used by default. Either you can restrict this on the server, or make the client specify that they want JSON. In one of my JavaScript example I do it like this: B-Translator.github.io/api-examples-js/examples/oauth2/get_user_profile.js at master Ā· B-Translator/B-Translator.github.io Ā· GitHub
Apparently it also works if you append the extension .json to the URL (you discovered this). As long as it works, it is fine.
I tried this and could not get it to work, neither in my own REST client, nor in your b-translator, as dataType will always default to json (I tried āxmlā, for example).
Regardless, mercifully this is behind me! I also got my Kunena posts redirected, which is also merciful. So no problems!