How to authenticate one drive using MSAL api in Swift?

I am using MSAL pod library to authenticate the microsoft account. After that i want to access particular OneDrive account files into my ios app.

ServiceConstant class

struct ServiceConstants {
    static let kBaseURL = ""
    static let kDrive = "/users/fcd9cff6658ad065/drive"


override func viewDidLoad() {


func getAllDocumentsFromOneDrive() {
        // Setup OneDrive Linking
        let urlString = ServiceConstants.kBaseURL + ServiceConstants.kDrive
        print("URL : \(urlString)")
        print("Token : \(accessTokenMSAL)")

        let url = URL(string: urlString)
        var request = URLRequest(url: url!)

        // Set the Authorization header for the request. We use Bearer tokens, so we specify Bearer + the token we got from the result
        request.httpMethod = "GET"
        request.addValue("application/json", forHTTPHeaderField: "Content-Type")
        request.setValue("Bearer \(accessTokenMSAL)", forHTTPHeaderField: "Authorization")

        URLSession.shared.dataTask(with: request) { (data, response, error) in
            if let err = error {
                print("Error : \(err.localizedDescription)")

            guard let result = try? JSONSerialization.jsonObject(with: data!, options: []) else {
                print("Couldn't deserialize result JSON")

            print("Result from Graph: \(result))")


Output : This is the output when access particular user onedrive files.

Result from Graph: {
    error =     {
        code = unauthenticated;
        innerError =         {
            date = "2018-11-08T05:15:10";
            "request-id" = "b5372309-dc14-4d66-a274-9ca94fcbf04f";
        message = "Must be authenticated to use '/drive' syntax";