Resource icon

[bd] API 1.6.1

No permission to download
@Jarvis no-no, it's not specifically for you :) Just for members, who want to create simple authorization over [bd] Api and own Laravel app.
Ah sorry.

Yes I already had a similar thing read to go! But I wasn't sure if the SocialteManager community repo would accept a PR from a provider which relied on env's
 

xfrocks

Well-known member
- Firstly, are you cool with me packaging my wrapper on packagist and leaving it open source for others to use in their own laravel apps?
I'm cool :love:

- I scanned back through this thread and saw you mention about making an 'admin token' for an admin account that can access all of a given forums data. Is there a way I can keep this token going indeffinitely, or will I have to Auth it each time I want to make a request? I saw the 'Time to live' option in the backend, but this is a limit that could one day expire.
Unfortunately no, token will expire eventually. However, if you plan to hardcode a token into some app (highly recommend not to do that), you can generate the token with normal flow and edit the token expire date in the db to some large value. As I said, it's not a good idea really.

- Are you happy for me to send PR's of your documentation on Github? I feel that it could be cleaned up slightly as I go along wrapping it up.
Please do. I will try to merge it asap.
 
Unfortunately no, token will expire eventually. However, if you plan to hardcode a token into some app (highly recommend not to do that), you can generate the token with normal flow and edit the token expire date in the db to some large value. As I said, it's not a good idea really.
How would you recommend handling this?

I'd like to have a 'bot' account that handles most of the standard things such as creating PMs between 2 users etc. But of course, the bot won't normally 'login' to my external auth

Any tips or tricks?
 

xfrocks

Well-known member
How would you recommend handling this?

I'd like to have a 'bot' account that handles most of the standard things such as creating PMs between 2 users etc. But of course, the bot won't normally 'login' to my external auth

Any tips or tricks?
If it's your bot and you are sure that the token won't leak, you can do the manual edit as I mentioned. Or you can create token and give it a long expire date. IIRC the underlying library does not support permanent token so this add-on currently does not do that. Probably in the XenForo 2 rewrite we will fix that.
 
Probably in the XenForo 2 rewrite we will fix that.
Awesome. I'll probably do the edit for my own installation, and update as needed if you add that in Xen 2

I'll still publish the package, but I'll work it around a given user instead of an 'admin' token. Then maybe refactor or release another if, again, we get that sweet functionality from you in Xen 2!
 

Triops

Well-known member
@Hi @xfrocks,

Thank you for this great addon! We start to use it with a large custom application based on a framework and it seems, that we now got the break through. May I ask two questions?

1.) Can you provide PHP7 compatibility, please? I'll send you a private conversation with tiny modifications, which we would think are needed.
2.) Do you intend to port this over to XF2? Not immediatly, but within the next +6 months, maybe?

Once again THANK YOU!
 

Triops

Well-known member
Does anybody have it already fully implemented to login in Mediawiki?
It seems 2014 was this not the case? Did anybody do so till today? You could contact me per private conversation, please.

I just would like to know, if this is a doable project for a good developer (so anyone succeeded?) or if there any showblockers when trying to realize a bridge to MediaWiki (current version is 1.29).
My required bridge would just be an user validation against the Xenforo user database, so that XF-users can login into and write/change articles in MediaWiki. No full bridge with all possible aspects and directions necessary.

THANK YOU for any hint in advance.
 
Hey there, so im wanting to make a seperate website that uses my Xenforo userbase as login credentials then gather data like amount of posts, groups, join date, last online, etc. Is there any simple way to do this? I dont need the API to post anything anywhere, just check if user credentials are correct and gather some simple user data.
 

xfrocks

Well-known member
Hey there, so im wanting to make a seperate website that uses my Xenforo userbase as login credentials then gather data like amount of posts, groups, join date, last online, etc. Is there any simple way to do this? I dont need the API to post anything anywhere, just check if user credentials are correct and gather some simple user data.
This add-on is over qualify for your need but it's quite simple to use and there should be existing library to deal with it (the add-on uses OAuth 2). It should be quite straight forward.
 
@Valiantiam @overifist @xfrocks
I've just managed to get this working with RocketChat!
It does take some manual editing of code on RocketChat though (I will try and submit it to them for a future patch, if I can figure out how github works!)

Firstly, these are the settings you need (obviously change the URL to match your forum location):
Capture.PNG

In Rocket.Chat, you then need to edit the following file:
/opt/Rocket.Chat/programs/server/packages/rocketchat_custom-oauth.js
(adjust if you've installed it elsewhere)

Go down to about line 254 and add the following in between the other if statements:
JavaScript:
// Fix for Xenforo [BD]API
if (identity.user && identity.user.user_id && !identity.id) {
    identity.id = identity.user.user_id;
    identity.email = identity.user.user_email;
}
So it should look something like:
JavaScript:
if (identity.CharacterID && !identity.id) {
        identity.id = identity.CharacterID;
}// Fix Dataporten having 'user.userid' instead of 'id'

// Fix for Xenforo [BD]API
if (identity.user && identity.user.user_id && !identity.id) {
        identity.id = identity.user.user_id;
        identity.email = identity.user.user_email;
}

if (identity.user && identity.user.userid && !identity.id) {
        identity.id = identity.user.userid;
        identity.email = identity.user.email;
} // Fix general 'phid' instead of 'id' from phabricator
Then restart the Rocket.Chat service so it picks up the new file and that should do it!
 
I've just managed to get this working with RocketChat!
It does take some manual editing of code on RocketChat though (I will try and submit it to them for a future patch, if I can figure out how github works!)
I just submitted it for ya. Gave you credit of course. Thanks for all your hard work on this.
 
Hi xfrocks,

I'm tempted to install this to our forum, just a few quick questions:
  • Since 2.0 has just dropped, is there going to be support any time soon?
  • We will have our users within Auth0, is this something that can be interacted with through this API?

Thanks,
Ryan
 
Last edited:

xfrocks

Well-known member
Hi xfrocks,

I'm tempted to install this to our forum, just a few quick questions:
  • Since 2.0 has just dropped, is there going to be support any time soon?
  • We will have our users within Auth0, is this something that can be interacted with through this API?

Thanks,
Ryan
Yes, we hope to push the XenForo 2 version as soon as possible.

And yes, you should be able to authenticate via OAuth2. I haven't personally used Auth0 though.
 

Gene Steinberg

Well-known member
Also, I'm using the original api.php file in connection with authentication for a password-protected access to downloading files from our premium area, which requires a member upgrade. Does this version straight-on replace that one, or must I have someone recode the file we use to interact with api.php?

If only I was a PHP developer.
 
Top