Skip to content

Commit

Permalink
Modified auth mechanism. Test 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Morar committed Feb 12, 2024
1 parent 8bfb484 commit 798c995
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@ jobs:
ls -d -1 "$PWD/"**/
ls -l
- name: Get csrf token from Anki
id: authRequest
uses: fjogeleit/http-request-action@master
with:
url: 'https://ankiweb.net/account/login'
method: 'GET'
# - name: Get csrf token from Anki
# id: authRequest
# uses: fjogeleit/http-request-action@master
# with:
# url: 'https://ankiweb.net/account/login'
# method: 'GET'

- name: Retrieve CSRF token
run: echo ${{ steps.authRequest.outputs.response }} | grep -oP 'csrf_token" value="\K([^"]+)' > token.txt
# - name: Retrieve CSRF token
# run: echo ${{ steps.authRequest.outputs.response }} | grep -oP 'csrf_token" value="\K([^"]+)' > token.txt

- name: Auth with Anki
- name: Authenticate with Anki
env:
ANKILOGIN: ${{ secrets.ANKILOGIN }}
ANKIPASSWORD: ${{ secrets.ANKIPASSWORD }}
ANKI_LOGIN: ${{ secrets.ANKILOGI_N }}
ANKI_PASSWORD: ${{ secrets.ANKIPASSWORD }}

run: |
CSRF=$(cat token.txt)
curl -d 'submitted=1&csrf_token='$CSRF'&username='$ANKILOGIN'&password='$ANKIPASSWORD https://ankiweb.net/account/login -c $GITHUB_WORKSPACE/cookie -b 'ankiweb=login' > null
curl -d $'\n\u0010'$ANKI_LOGIN$'\u0012\u000'$ANKI_PASSWORD https://ankiweb.net/svc/account/login -c $GITHUB_WORKSPACE/cookie -b 'ankiweb=login' > null
echo "ANKI_COOKIE="$(cat $GITHUB_WORKSPACE/cookie | grep -oP '^#HttpOnly_ankiweb.net.+ankiweb\s+\K.+$') >> $GITHUB_ENV
Expand Down

0 comments on commit 798c995

Please sign in to comment.