Auth0 Home Blog Docs

Unable to set scope using iOS SDK

ios

#1

I am trying to use the webAuth api to login, here is my code:

    Auth0
    .webAuth()
    .parameters(params)
    .audience("https://<myApp>/userinfo")
    .scope("openid profile email read:users update:users update:current_user_identities user_id id sub v2_id update:users update:users_app_metadata update:current_user_metadata")
        .start {

            switch $0 {
            case .failure(let error):
                print("Error \(error)")

            case .success(let credentials):
                SessionManager.shared.store(credentials: credentials)
                print ("Credentials: \(credentials)")
            }

When I check credentials.scope I only get: openid, profile and email returned in the credentials. I need to be able to write to the user metadata and at the moment patch fails due to the bearer being invalid.

Am I missing something, or is there an error in the SDK. My colleagues doing this on Android do not seem to be having the same problems.


#3

:wave: @trevor.doodes are you looking to update the user information? Can you ensure that you are using an Auth0 Management APIv2 token to achieve this? In order to get a token for the Management API we would need to set the audience for it: .audience("https://YOUR_AUTH0_DOMAIN/api/v2/") . Can you let me know if you were able to solve your issue?

An example of making a patch in iOS that might be helpful can be found here