Oauth config for memberful (not working)


(Jay Pfaffman) #1

A client wants some people to use Memberful, so the default SSO solution won’t work. They also support oauth. To my naive eye, it looks standard enough, so I installed the oauth basic support plugin and set out to configure stuff.

It gets far enough to generate the user_json_url correctly; if I open up the URL printed in the logs in a web browser, I get what I’m looking for. But it generates a 500 error and the “Oops” message in the browser.

I can’t tell if it’s something on my side or the Memberful side. I’m pretty clear that this will need a plugin to pull group/order information, but thought that just getting authorizations to would might work with the stock plugin.

I configured the redirect url on the memberful side to be Redirect URLhttps://support.literatecomputing.com/auth/oauth2_basic/callback

Here are the logs:

[default] (oauth2_basic) Setup endpoint detected, running now.
[default] (oauth2_basic) Callback phase initiated.
[default] Processing by Users::OmniauthCallbacksController#complete as HTML
[default]   Parameters: {"code"=>"CODE", "state"=>"STATE", "provider"=>"oauth2_basic"}
[default] OAuth2 Debugging: after_authenticate response: 

creds: {"token"=>"A_TOKEN", "refresh_token"=>"RTOKEN", "expires_at"=>1525127745, "expires"=>true}
info: {"id"=>nil, "name"=>nil}
extra: {}
[default] OAuth2 Debugging: user_json_url: GET https://lc.memberful.com/account.json?access_token=A_TOKEN
[default] Completed 500 Internal Server Error in 237ms (ActiveRecord: 2.8ms)
[default] OpenURI::HTTPError (500 Internal Server Error)
/usr/local/lib/ruby/2.4.0/open-uri.rb:363:in `open_http'

https://lc.memberful.com/oauth?client_id=608a20a606726ef6b1f7c596836489c0&redirect_uri=https%3A%2F%2Fsupport.literatecomputing.com%2Fauth%2Foauth2_basic%2Fcallback&response_type=code&state=4f01a498e737d8c517cfe58f9dfcc4e6e59a36e0830bdaef

https://support.literatecomputing.com/auth/oauth2_basic/callback?code=71c0ac207b30cb23d297be65c6316c3d&state=4f01a498e737d8c517cfe58f9dfcc4e6e59a36e0830bdaef

I can’t quite figure out just what’s wrong with

The JSON returned by Memberful looks like this:

{
member: {
address: { },
created_at: 1524522604,
credit_card: {
exp_month: 11,
exp_year: 2022
},
custom_field: "",
email: "jay@example.com",
first_name: "Jay",
full_name: "Jay Pfaffman",
id: 542677,
last_name: "Pfaffman",
phone_number: null,
tracking_params: { },
unrestricted_access: false,
username: "jay1192885"
},
...

I’ve configured oauth2 json stuff like this:

oauth2 json user id path: member.id
oauth2 json username path: member.username
oauth2 json name path: member.full_name
oauth2 json email path: member.email