Skip to content

Commit 951a8bf

Browse files
committed
When using 3rd party authentication provider, send over the CSRFToken
1 parent 2710a3c commit 951a8bf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/core/qfieldcloudconnection.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,16 @@ void QFieldCloudConnection::setAuthenticationToken( QNetworkRequest &request )
612612
}
613613

614614
QgsApplication::instance()->authManager()->updateNetworkRequest( request, mProviderConfigId );
615+
const QList<QNetworkCookie> cookies = QgsNetworkAccessManager::instance()->cookieJar()->cookiesForUrl( mUrl );
616+
for ( const QNetworkCookie &cookie : cookies )
617+
{
618+
if ( cookie.name() == QLatin1String( "csrftoken" ) )
619+
{
620+
request.setRawHeader( "X-CSRFToken", cookie.value() );
621+
request.setRawHeader( "Referer", mUrl.toLatin1() );
622+
break;
623+
}
624+
}
615625
}
616626
}
617627

0 commit comments

Comments
 (0)