all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How do you do authentication with url.el?
       [not found] <CAAdUY-+p_joWLLWKQPjRJQ774EanB9jePOFthp_V-OsNJPaNNQ@mail.gmail.com>
@ 2015-11-13  1:09 ` Artur Malabarba
  2015-11-13  1:45   ` Lee B
  0 siblings, 1 reply; 8+ messages in thread
From: Artur Malabarba @ 2015-11-13  1:09 UTC (permalink / raw
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 340 bytes --]

I'm trying to  communicate with a Restful api using url.el. When it comes
to authentication, their documentation simply says to call curl with "-u
user:password".

What is the url equivalent of that option in curl? That is, how do I
replicate the following command with url-retrieve-synchronously?
    curl -u user:password https://gnu.org

[-- Attachment #2: Type: text/html, Size: 430 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How do you do authentication with url.el?
  2015-11-13  1:09 ` How do you do authentication with url.el? Artur Malabarba
@ 2015-11-13  1:45   ` Lee B
  2015-11-13 12:05     ` Artur Malabarba
  0 siblings, 1 reply; 8+ messages in thread
From: Lee B @ 2015-11-13  1:45 UTC (permalink / raw
  To: bruce.connor.am; +Cc: emacs-devel


On Fri, Nov 13 2015, Artur Malabarba wrote:

> I'm trying to communicate with a Restful api using url.el. When it comes to
> authentication, their documentation simply says to call curl with "-u
> user:password".
>
> What is the url equivalent of that option in curl? That is, how do I replicate
> the following command with url-retrieve-synchronously?
>  curl -u user:password https://gnu.org

Does something like 'https://username:password@domain' work?

Lee.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How do you do authentication with url.el?
  2015-11-13  1:45   ` Lee B
@ 2015-11-13 12:05     ` Artur Malabarba
  2015-11-13 13:05       ` Artur Malabarba
  2015-11-13 18:37       ` raman
  0 siblings, 2 replies; 8+ messages in thread
From: Artur Malabarba @ 2015-11-13 12:05 UTC (permalink / raw
  To: Lee B; +Cc: emacs-devel

It does. Thanks Lee.

2015-11-13 1:45 GMT+00:00 Lee B <lboc.home@gmail.com>:
>
> On Fri, Nov 13 2015, Artur Malabarba wrote:
>
>> I'm trying to communicate with a Restful api using url.el. When it comes to
>> authentication, their documentation simply says to call curl with "-u
>> user:password".
>>
>> What is the url equivalent of that option in curl? That is, how do I replicate
>> the following command with url-retrieve-synchronously?
>>  curl -u user:password https://gnu.org
>
> Does something like 'https://username:password@domain' work?
>
> Lee.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How do you do authentication with url.el?
  2015-11-13 12:05     ` Artur Malabarba
@ 2015-11-13 13:05       ` Artur Malabarba
  2015-11-13 13:16         ` Artur Malabarba
  2015-11-13 18:37       ` raman
  1 sibling, 1 reply; 8+ messages in thread
From: Artur Malabarba @ 2015-11-13 13:05 UTC (permalink / raw
  To: Lee B; +Cc: emacs-devel

2015-11-13 12:05 GMT+00:00 Artur Malabarba <bruce.connor.am@gmail.com>:
> It does. Thanks Lee.

Actually no, sorry. It doesn't work.
url-retrieve-synchronously still asks me for a user/password
combination even if I write it like that.

It appeared to work before because url was using some cache of a
previous authentication.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How do you do authentication with url.el?
  2015-11-13 13:05       ` Artur Malabarba
@ 2015-11-13 13:16         ` Artur Malabarba
  2015-11-13 14:18           ` Dan LaManna
  0 siblings, 1 reply; 8+ messages in thread
From: Artur Malabarba @ 2015-11-13 13:16 UTC (permalink / raw
  Cc: emacs-devel

> url-retrieve-synchronously still asks me for a user/password
> combination even if I write it like that.

Just to clarify what's happening. Running this command succeeds immediately:
      curl -X PUT
https://USER:TOKEN@api.github.com/user/starred/Malabarba/EndlessParentheses

But evaluating this asks me for a user/password combination:
    (let ((url-request-method "PUT"))
      (url-retrieve-synchronously
"https://USER:TOKEN@api.github.com/user/starred/Malabarba/EndlessParentheses"))



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How do you do authentication with url.el?
  2015-11-13 13:16         ` Artur Malabarba
@ 2015-11-13 14:18           ` Dan LaManna
  2015-11-13 14:34             ` Artur Malabarba
  0 siblings, 1 reply; 8+ messages in thread
From: Dan LaManna @ 2015-11-13 14:18 UTC (permalink / raw
  To: Artur Malabarba; +Cc: emacs-devel

This should work:

(let ((url-request-method "PUT")
      (url-request-extra-headers 
          `(("Authorization" . ,(concat "Basic "
                                        (base64-encode-string
                                         "user:token"))))))
  (url-retrieve-synchronously
"https://api.github.com/user/starred/Malabarba/EndlessParentheses"))

Left you a star ;)

On Fri, 13 Nov 2015 13:16:14 +0000
Artur Malabarba <bruce.connor.am@gmail.com> wrote:

> > url-retrieve-synchronously still asks me for a user/password
> > combination even if I write it like that.
> 
> Just to clarify what's happening. Running this command succeeds
> immediately: curl -X PUT
> https://USER:TOKEN@api.github.com/user/starred/Malabarba/EndlessParentheses
> 
> But evaluating this asks me for a user/password combination:
>     (let ((url-request-method "PUT"))
>       (url-retrieve-synchronously
> "https://USER:TOKEN@api.github.com/user/starred/Malabarba/EndlessParentheses"))
> 




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How do you do authentication with url.el?
  2015-11-13 14:18           ` Dan LaManna
@ 2015-11-13 14:34             ` Artur Malabarba
  0 siblings, 0 replies; 8+ messages in thread
From: Artur Malabarba @ 2015-11-13 14:34 UTC (permalink / raw
  To: Dan LaManna; +Cc: emacs-devel

2015-11-13 14:18 GMT+00:00 Dan LaManna <me@danlamanna.com>:
> This should work:
>
> (let ((url-request-method "PUT")
>       (url-request-extra-headers
>           `(("Authorization" . ,(concat "Basic "
>                                         (base64-encode-string
>                                          "user:token"))))))
>   (url-retrieve-synchronously
> "https://api.github.com/user/starred/Malabarba/EndlessParentheses"))

Indeed it does. Thanks!

> Left you a star ;)

My plan worked!



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How do you do authentication with url.el?
  2015-11-13 12:05     ` Artur Malabarba
  2015-11-13 13:05       ` Artur Malabarba
@ 2015-11-13 18:37       ` raman
  1 sibling, 0 replies; 8+ messages in thread
From: raman @ 2015-11-13 18:37 UTC (permalink / raw
  To: Artur Malabarba; +Cc: emacs-devel, Lee B

Artur Malabarba <bruce.connor.am@gmail.com> writes:

:-) It's a little known fact, but this aspect of URLs was originally
created to enable accessing ftp content via URLs. > It does. Thanks Lee.
>
> 2015-11-13 1:45 GMT+00:00 Lee B <lboc.home@gmail.com>:
>>
>> On Fri, Nov 13 2015, Artur Malabarba wrote:
>>
>>> I'm trying to communicate with a Restful api using url.el. When it comes to
>>> authentication, their documentation simply says to call curl with "-u
>>> user:password".
>>>
>>> What is the url equivalent of that option in curl? That is, how do I replicate
>>> the following command with url-retrieve-synchronously?
>>>  curl -u user:password https://gnu.org
>>
>> Does something like 'https://username:password@domain' work?
>>
>> Lee.
>

-- 



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-11-13 18:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAAdUY-+p_joWLLWKQPjRJQ774EanB9jePOFthp_V-OsNJPaNNQ@mail.gmail.com>
2015-11-13  1:09 ` How do you do authentication with url.el? Artur Malabarba
2015-11-13  1:45   ` Lee B
2015-11-13 12:05     ` Artur Malabarba
2015-11-13 13:05       ` Artur Malabarba
2015-11-13 13:16         ` Artur Malabarba
2015-11-13 14:18           ` Dan LaManna
2015-11-13 14:34             ` Artur Malabarba
2015-11-13 18:37       ` raman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.