As of Services 7.x-3.6, a separate request is not needed to get the CSRF token. It is provided by the /user/login endpoint. Ref. #2115579: How about return token in user login service? and this commit.

Here's a backwards compatible patch that should make deployments to sites on Services 7.x-3.6 or newer quicker!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

star-szr’s picture

Title: Get XSRF token from /user/login endpoint » Get CSRF token from /user/login endpoint
Status: Active » Needs review
FileSize
3.73 KB

Fixing typo, attaching patch :)

Dreditor is going to make the changes look like a lot but really there are only ~8 lines of code changing if you ignore whitespace, I would recommend git diff -w or a visual difftool that can ignore whitespace for reviewing the changes.

star-szr’s picture

FileSize
4 KB
870 bytes

And if you don't object, this typo can be fixed as well, hehe.

star-szr’s picture

Issue summary: View changes

Fixing my typo in the issue summary as well.

star-szr’s picture

Adding a potentially related issue, since this could solve a bug reported there where the destination site is being hosted from a subdirectory.

star-szr’s picture

Priority: Normal » Major

After a few days of testing, I can say that this patch is making my deployments actually quite noticeably faster.

reevo’s picture

Re-rolling the above patch for current 7.x-2.x-dev

star-szr’s picture

Thanks @reevo, from another Reeves :)

That patch should work the same as #1, it just doesn't have the typo fix. But that could be argued as out of scope.

  • skwashd committed e6b4a35 on 7.x-2.x authored by Cottser
    Issue #2388119 by Cottser, reevo: Get CSRF token from /user/login...
  • skwashd committed f4f148f on 7.x-2.x
    Merge pull request #12 from dickolsson/2388119
    
    Issue #2388119 by...
skwashd’s picture

Status: Needs review » Fixed

Thanks for your work on this. I've merged the patch.

  • skwashd committed e6b4a35 on 8.x-1.x authored by Cottser
    Issue #2388119 by Cottser, reevo: Get CSRF token from /user/login...
  • skwashd committed f4f148f on 8.x-1.x
    Merge pull request #12 from dickolsson/2388119
    
    Issue #2388119 by...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.