Discourse API - where to start? what is my API url?


(riz) #4

I also found this in terms of generate API key
OK, so i’m guessing i use this somwhere, but where and when?

And what is my api key? is there a dashboard i go to find that out or what?

{
“api_key”: {
“id”: 0,
“key”: “string”,
“user”: {}
}
}


(Cee Kay) #5

Go to yoursitename_com/admin and click API. You can generate the API key from there.


(riz) #6

Dear Sir,

That’s where i thought it would be as well, but when i go to my /admin page, the word API is not on that page anywhere

I just did a Cntrl Find “API” and its not there

I’m using a hosted version of discourse, hosted by discourse.org, so the setup of discourse should all be correct.

So do i need to enable something to see the API link on the admin page?


(riz) #7

So this is exactly where i am navigating to
http://reiconnect.trydiscourse.com/admin


(riz) #8

Dear Sir,

I’ve made some progress, i found the API section in admin

I was logged in as my moderator, now im in as an admin and can see all the options.

So anyway, when i generate a key, should i be making a master key or a user specific key?


(Robin Ward) #9

If you want to create a user, you probably want to use a master key since that is an admin level thing. Be sure to keep the key secret as if anyone finds it they can perform any operation on your site!


(Cee Kay) #10

You should be making a master Key. But be alarmed! and do not share the key.


(riz) #11

I’m a little uncertain if i should be making a new user or setting up SSO.

So what i want to have happen is that people who sign into my website, they can automatically post to my discourse forum.

So should i be researching how to setup SSO or how to create users?


(Cee Kay) #12

Better learn to set up SSO


(riz) #13

Thanks,

Are you able to give me some high level direction on how to achieve this or point me to some resources?


(Rafael dos Santos Silva) #14

Our official docs have everything you need to implement SSO.


(riz) #15

Dear Sir,

I’ve read that page, and it’s not easy to follow.

So i could go into my admin and enable SSO and do all that,

But then on the other end, i’m unsure exactly what to do, the link you sent talk about it to some extent, but i’m still rather uncertain of how to aheive it.

An actual video walkthrough would be good.

Allot of the example focus on wordpress or ruby. I’m using a custom website that is not on wordpress or on ruby,


(Rafael dos Santos Silva) #16

To implement SSO, you will need to create a web service that will handle receiving a request, and crafting a response.

It will be largely related to the code involved in your own site authentication and authorization.

The same developer who engineered your custom site auth should be able to create this new route. If any specific roadblock is found you can create a topic in #dev about it.

Also, if you found that SSO is too much trouble, enabling the usual social logins (Facebook/Twitter/Google) should suffice.


(riz) #17

I’ve built my site on bubble.is myself, it’s a nice codefree environment.

There i already have FB login option available, and users can login to my site with either email/pwd or FB.

What i would like is to see an end to end example of how others have done this on their custom site.

Based on that example, i would be able to work out what i need to do on my site.

Any videos or step by step walk throughs of this?


(riz) #18

Can you give me some more info on how to exactly create a user?

Also what is the use case for creating a user?

If i create a user, does that mean that when the users signs in from my custom website (reiconnect.co) then he no longer needs to sign into discourse, and can post straight away


(Robin Ward) #19

Sorry I was just trying to help you figure out how to use the API. Using the API to create a user doesn’t mean anyone will be logged in.

What it sounds like you want is to implement SSO. I’d suggest reading this topic. Your custom website can provide the SSO.

Having said that I think they’ll still have to click the Login button on the forum, it’ll just require no additional steps if they’re logged in on your other site. It’ll just redirect them back and they’ll be good to post.


(riz) #20

@eviltrout Thanks,

Yes i need SSO, I’ve read that material, and it seems difficult to setup on my custom site.
It’s lacking an example, like a simple walk through of how one would set that up on their custom website.

Great if someone had like a video walkthrough of how they have set it up.


(Robin Ward) #21

It’s unfortunately going to require some programming on your side. We can’t really make a video tutorial since it involves integrating into your system and that would be different every time. If it’s too complicated, perhaps you can find a contractor willing to help you out.


(riz) #22

Hello,

I get that it’s different for each system.
But if you had a video even for like a PHP system or something it would just be easy to understand exactly what needs to be done on what environments and where your getting all the info from.

Any chance of doing this?


(Robin Ward) #23

Sorry, but we have no plans to make such a video.