vermiculus / sx.el

Stack Exchange for Emacs
http://stackapps.com/q/3950
709 stars 40 forks source link

Authentication woes #342

Closed basil-conto closed 5 years ago

basil-conto commented 6 years ago

sx-version:

0.3 of 2018-01-28

emacs-version:

GNU Emacs 27.0.50 (build 4, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2018-02-03
  1. emacs -Q
  2. M-xpackage-initializeRET
  3. M-xsx-authenticateRET
    • Expected result: browser displays page with authentication token
    • Actual result: browser reports
      `http%3A%2F%2Fseanallred.com%2Fsx.el%2Fauth%2Fauth.htm` is not a valid uri
  4. C-g
  5. M-xfind-functionRETsx-authenticateRET
  6. C-ssx-auth-redirect-uri
  7. C-M-b
  8. M-xraise-sexpRET
  9. C-M-x
  10. M-xsx-authenticateRET
  11. Copy token displayed in browser into minibuffer and type RET
  12. M-xtoggle-debug-on-errorRET
  13. M-xsx-inboxRET
    • Expected result: SX inbox displayed
    • Actual result:
      Debugger entered--Lisp error: (error "Request failed: (nil) [403 access_denied] \"access_token was not created with `read_inbox` scope\"")
      signal(error ("Request failed: (nil) [403 access_denied] \"access_token was not created with `read_inbox` scope\""))
      error("Request failed: (%s) [%i %s] %S" nil 403 "access_denied" "access_token was not created with `read_inbox` scope")
      sx-request-make("inbox" ((pagesize . 100) (page . 1) (filter . "abcdefghijklmnopqrs")) get sx-request-response-get-items)
      sx-method-call(inbox :keywords nil :page 1 :filter ((inbox_item\.answer_id inbox_item\.body inbox_item\.comment_id inbox_item\.creation_date inbox_item\.is_unread inbox_item\.item_type inbox_item\.link inbox_item\.question_id inbox_item\.site inbox_item\.title) (site\.logo_url site\.audience site\.icon_url site\.high_resolution_icon_url site\.site_state site\.launch_date site\.markdown_extensions site\.related_sites site\.styling)))
      sx-inbox-get(nil 1)
      #f(compiled-function (page) #<bytecode 0x12f7ed1>)(1)
      sx-question-list-refresh()
      run-hooks(tabulated-list-revert-hook)
      tabulated-list-revert()
      sx-inbox(nil)
basil-conto commented 6 years ago

Speedy Gonzales support team! :)

vermiculus commented 6 years ago

The fact that my main project right now is a github client certainly helps 😉

Luis-Henriquez-Perez commented 6 years ago

To be clear, is there an alternative way to authenticate? Or is this package unable to authenticate at by any means this time?

vermiculus commented 6 years ago

I am unsure, to be perfectly honest. It's been a long time since I've worked with SE auth myself.

While I might not have had time to work on this project lately, I do promise I'd review/merge pull requests reasonably quickly if you're able to do the development.

basil-conto commented 6 years ago

Here's an update of the recipe:

emacs-version:

In GNU Emacs 27.0.50 (build 10, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2018-06-04 built on thunk
Repository revision: 1dafa4a02ed45bb4d02c6dc34c55518858422088
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Debian GNU/Linux buster/sid
  1. emacs -Q
  2. M-xpackage-initializeRET
  3. M-xsx-authenticateRET
    • Expected result: browser displays page with authentication token
    • Actual result: browser reports:
      `redirect_uri` is not under the registered domain for this application

I wonder if this is caused by 46d9498e8f501697920c79437909cdddc93d5ec6?

e2m4n commented 5 years ago

@basil-conto good find! I worked around it by changing the stackoverflow oauth URL so that the domain part of redirect_uri was what it was before. Then I could authenticate, and got redirected to a 404 page. The auth token is there in the URL of that page for pasting back into emacs.

basil-conto commented 5 years ago

Thanks @e2m4n, that works.

manandearth commented 5 years ago

@e2m4n

so that the domain part of redirect_uri was what it was before

What was it before?

manandearth commented 5 years ago

Oh.. found it. You mean: http%3A%2F%2Fseanallred.com%2Fsx.el%2Fauth%2Fauth.htm

Thanks!

matthew-piziak commented 5 years ago

I'm still getting "redirect_uri is not under the registered domain for this application" when I run sx-authenticate. Is this something that hasn't been patched into the sx library yet?

vermiculus commented 5 years ago

That's likely. If someone wants to take a crack at it I'd be more than happy to review and merge a PR, but otherwise I won't likely have to investigate this with all my other commitments :frown:

e2m4n commented 5 years ago

The error message is from Stack Overflow, and suggests that this can only be resolved by the Stack Apps app owner by adding the new domain to the whitelist. Once that's done this issue will auto-resolve :-)

vermiculus commented 5 years ago

I've edited the OAuth domain to vermiculus.github.io – can someone verify if that was sufficient to address this issue?

matthew-piziak commented 5 years ago

@vermiculus I've reached "Good news! Authentication was successful. Your authentication token is..." and pasted in my token. However upon, say, sx-inbox, I get sx-request-make: Request failed: (nil) [403 access_denied] "keyis not valid for passedaccess_token, token not found.".

basil-conto commented 5 years ago

@vermiculus Thanks, everything works for me now.

matthew-piziak commented 5 years ago

Still broken for me. Same error:

sx-request-make: Request failed: (nil) [403 access_denied] "`key` is not valid for passed `access_token`, token not found."
matthew-piziak commented 5 years ago

Works for me now!

basil-conto commented 5 years ago

Great, I'm therefore closing this report for now.

godfrey-cw commented 4 years ago

Getting the same error as @matthew-piziak -- any update on this front?

basil-conto commented 4 years ago

Getting the same error as @matthew-piziak -- any update on this front?

Please provide the exact steps that you are taking along with what you expect and actually see at each stage, as I think authentication has been working for everyone here for a while now.

godfrey-cw commented 4 years ago

Sorry, realize now my last comment wasn't very constructive.

Just followed the directions in the read me. So, 1. M-x package install ...

  1. sx-authenticate 3. Copy-paste the code. 4. sx- yields the above mentioned error.

Further iterations of the authenticate step didn't seem to help.

One thing that made me scratch my head was the first time I went to authenticate I was asked to create some sort of new account ... Which I did since I didn't know how else to get through that step (even though I already have a stack exchange account). Did I mess that step up perhaps?

Thanks for your patience all.

On Sun, Oct 13, 2019, 7:06 AM Basil L. Contovounesios < notifications@github.com> wrote:

Getting the same error as @matthew-piziak https://github.com/matthew-piziak -- any update on this front?

Please provide the exact steps that you are taking along with what you expect and actually see at each stage, as I think authentication has been working for everyone here for a while now.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vermiculus/sx.el/issues/342?email_source=notifications&email_token=AJGIXUVFVGSULUCHQAOBIKLQOMTLNA5CNFSM4EPCL6TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBCW5XY#issuecomment-541421279, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJGIXUR4MYDEP2ZQMJFBHWTQOMTLNANCNFSM4EPCL6TA .

matthew-piziak commented 4 years ago

@godfrey-cw Are you being careful with leading/trailing whitespace? I don't quite remember but I think that that tripped me up at some point.