<div dir="ltr">Hi,<div><br></div><div>I'm trying to change credential after a successful login, but without success, and I wonder it's not possible, so I ask to the community what's I'm doing wrong.</div><div>

The only way I found to login as new user is closing and opening again qgis :|</div><div><br></div><div>the workflow it this one</div><div><br></div><div>first correct login</div><div><br></div><div>1) get a QgsNetworkAccessManager instance</div>

<div>2) prepare a request</div><div>3) auth is required by the server => <span style="color:rgb(128,0,128)">QgisApp</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">namAuthenticationRequired is called</span></div>

<div><span style="color:rgb(0,0,0)">4) in </span><font color="#000000">QgisApp::namAuthenticationRequired QgsCredential get(...) is used to ask user and password that are set in the QAuthenticator</font></div><div><font color="#000000"><br>

</font></div><div><font color="#000000">all proceed well... but at a moment my plugin need to be used by other user, so next steps for a new requests are</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">5) get a QgsNetworkAccessManager instance</font></div>

<div><font color="#000000">6) prepare a request</font></div><div><font color="#000000">7) auth is required by the server, but QNetwarkAccessManager use cached credentials and NO signal AuthenticationRequired => it doesn't enter in QgisApp::namAuthenticationRequired => no credential are requested and continue with the old credentials</font></div>

<div><span style="color:rgb(0,0,0)"></span><br></div><div>QNetworkAccessManager reuse "old" QAutenticator so it is unuseful set new credentials with QgsCredentials::instance().put(). QgsCredentials are get only in QgisApp::namAuthenticationRequired that is called once (due the fact that QgsNetworkAccessManager is singleton?)</div>

<div><br></div><div>next QT version (qt5) has a QNetorkAccessManager::clearAccessCache(). Method not available in QT4. </div><div><br></div><div>Should I use directly QNetworkAccessManager instead of then singleton version forced by QgsNetworkAccessManager?</div>

<div><br></div><div>anyone know a way </div><div><br></div><div>Any help is appreciated,</div><div><br></div><div>Luigi Pirelli (<a href="mailto:luigi.pirelli@faunalia.it">luigi.pirelli@faunalia.it</a> - <a href="mailto:luipir@gmail.com">luipir@gmail.com</a>)</div>

<div><br></div><div><br></div>
</div>