Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting unauthorised error from server #4

Open
AnilkumarRabhasa opened this issue Aug 12, 2022 · 0 comments
Open

Getting unauthorised error from server #4

AnilkumarRabhasa opened this issue Aug 12, 2022 · 0 comments

Comments

@AnilkumarRabhasa
Copy link

AnilkumarRabhasa commented Aug 12, 2022

Thanks for the great library, But, I am getting Unauthorised error though I am sending Bearer token to server.

    let form = MultipartForm(parts: [
        MultipartForm.Part(name: "Type", value: "\(categoryType)"),
        MultipartForm.Part(name: "file", data: imageData, filename: "\(imageeData.name)", contentType: "\(mimeType)"),
    ])

    var reequest = URLRequest(url: URL(string: url)!)
    reequest.httpMethod = "POST"
    reequest.setValue(form.contentType, forHTTPHeaderField: "Content-Type")
    reequest.addValue("Bearer \(SessionManager.accessToken ?? "")", forHTTPHeaderField: "Authorization")

The error from sever is below

{
"status" : 401,
"message" : "Unauthorized",
"timestamp" : "2022-08-12T10:10:26.204+0000",
"path" : "/uploadDocument",
"error" : "Unauthorized"
}
Can anyone help/suggest me where I am doing wrong here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant