Alamofire Basic and Oauth2
<p>I have been using Alamofire and it works fine for basic auth #1</p>

<pre><code>Alamofire.request(.GET, ENDPOINT_URL).authenticate(user:_username, password: _password).responseJSON { response in }
</code></pre>

<p>and for OAuth2 #2</p>

<pre><code>let headers = ["Authorization": "Bearer \(getLoginToken()!)"]

Alamofire.request(.POST, ENDPOINT_URL2, parameters: para, headers: headers,encoding: .JSON ).responseJSON {  response in }
</code></pre>

<p>Now i am changing some of the API  authentication to OAuth2, it will be a mixture of both Basic and OAuth. The problem comes at #3 </p>

<ol>
<li>I make Basic Auth Request first, authentication pass</li>
<li>I make OAuth2 Request first, authentication pass</li>
<li>I make Basic Auth Request and OAuth2 Request, authentication pass for Basic Auth and fail for OAuth2.</li>
</ol>

<p>After debugging, i realise that it is still sending the Basic Auth Request headers and the newly added headers is not reflected and updated to Alamofire. </p>

<p>I hava a Singleton APIClient class that calls <code>Alamofire.request()</code>. When i examine the Alamofire class, it turns out that the <code>Manager</code> is also a singleton class. I am guessing it could be due to the above singletons. </p>

<p>Any advice on how to send to pass the headers correctly? Or how to do Basic Auth &amp; OAuth2 one after another? </p>

<blockquote>
  <p>Alamofire: v3.1.2 </p>
  
  <p>XCode: 7.2.1</p>
  
  <p>IOS: 9 </p>
</blockquote>