Skip to content

Commit

Permalink
Add extra logging for sending id token to affiliation API.
Browse files Browse the repository at this point in the history
  • Loading branch information
charlon committed Jun 24, 2020
1 parent 82d24b1 commit 3a78172
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions myuw-ios/AppAuthController.swift
Expand Up @@ -125,8 +125,8 @@ class AppAuthController: UIViewController {
UserDefaults.standard.removeObject(forKey: kAppAuthExampleAuthStateKey)
UserDefaults.standard.removeObject(forKey: "lastTabIndex")

// clear userAffiliations
User.userAffiliations = []
// remove all existing affiliations and start with fresh array
User.userAffiliations.removeAll()

// show the sign-in content
headerText.isHidden = false
Expand Down Expand Up @@ -289,6 +289,7 @@ extension AppAuthController {

guard let data = UserDefaults.standard.object(forKey: kAppAuthExampleAuthStateKey) as? Data else {
os_log("no authorization state", log: .appAuth, type: .info)
os_log("ID token: %@", log: .appAuth, type: .error, authState?.lastTokenResponse?.idToken ?? "NONE")
return
}

Expand Down Expand Up @@ -470,6 +471,7 @@ extension AppAuthController {
var urlRequest = URLRequest(url: affiliationURL!)

// send id token in authorization header
os_log("ID token: %@", log: .appAuth, type: .error, self.authState?.lastTokenResponse?.idToken ?? "NONE")
urlRequest.setValue("Bearer \(self.authState?.lastTokenResponse?.idToken ?? "ID_TOKEN")", forHTTPHeaderField: "Authorization")

// create a task to request affiliations from myuw endpoint
Expand Down

0 comments on commit 3a78172

Please sign in to comment.