{"action":"closed","issue":{"url":"https://api.github.com/repos/auth0/react-native-lock/issues/39","repository_url":"https://api.github.com/repos/auth0/react-native-lock","labels_url":"https://api.github.com/repos/auth0/react-native-lock/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/auth0/react-native-lock/issues/39/comments","events_url":"https://api.github.com/repos/auth0/react-native-lock/issues/39/events","html_url":"https://github.com/auth0/react-native-lock/issues/39","id":153933081,"number":39,"title":"A0LockReact.m delegationWithOptions passes null dictionary when attempting to obtain firebase token, crashing app","user":{"login":"richardstephens","id":1400317,"avatar_url":"https://avatars.githubusercontent.com/u/1400317?v=3","gravatar_id":"","url":"https://api.github.com/users/richardstephens","html_url":"https://github.com/richardstephens","followers_url":"https://api.github.com/users/richardstephens/followers","following_url":"https://api.github.com/users/richardstephens/following{/other_user}","gists_url":"https://api.github.com/users/richardstephens/gists{/gist_id}","starred_url":"https://api.github.com/users/richardstephens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardstephens/subscriptions","organizations_url":"https://api.github.com/users/richardstephens/orgs","repos_url":"https://api.github.com/users/richardstephens/repos","events_url":"https://api.github.com/users/richardstephens/events{/privacy}","received_events_url":"https://api.github.com/users/richardstephens/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/auth0/react-native-lock/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-10T06:32:05Z","updated_at":"2016-05-17T06:26:54Z","closed_at":"2016-05-17T06:26:54Z","body":"Hi there,\r\n\r\nIf I attempt to obtain a firebase token through the Auth0 delegation API as such, my application crashes in native code.\r\n```\r\n    lock.delegation({\r\n        token: token,\r\n        api: \"firebase\"\r\n      }, (a,b,c) => {\r\n        console.log(\"delegation callback\",a,b,c);\r\n      });\r\n```\r\n\r\nThe crash I see in the XCode console is as follows:\r\n```\r\n\r\n2016-05-10 16:20:18.465 TodoApp[25813:911468] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[2]'\r\n*** First throw call stack:\r\n(\r\n\t0   CoreFoundation                      0x0000000112077d85 __exceptionPreprocess + 165\r\n\t1   libobjc.A.dylib                     0x000000011126cdeb objc_exception_throw + 48\r\n\t2   CoreFoundation                      0x0000000111f7423e -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 318\r\n\t3   CoreFoundation                      0x0000000111f865bb +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59\r\n\t4   TodoApp                             0x000000010e57e584 -[A0LockReact delegationWithOptions:callback:] + 1556\r\n\t5   TodoApp                             0x000000010e580fe4 __41-[A0LockReactModule delegation:callback:]_block_invoke + 84\r\n\t6   libdispatch.dylib                   0x0000000113a0fd9d _dispatch_call_block_and_release + 12\r\n\t7   libdispatch.dylib                   0x0000000113a303eb _dispatch_client_callout + 8\r\n\t8   libdispatch.dylib                   0x0000000113a181ef _dispatch_main_queue_callback_4CF + 1738\r\n\t9   CoreFoundation                      0x0000000111fd10f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9\r\n\t10  CoreFoundation                      0x0000000111f92b99 __CFRunLoopRun + 2073\r\n\t11  CoreFoundation                      0x0000000111f920f8 CFRunLoopRunSpecific + 488\r\n\t12  GraphicsServices                    0x000000011512cad2 GSEventRunModal + 161\r\n\t13  UIKit                               0x000000010f6f2f09 UIApplicationMain + 171\r\n\t14  TodoApp                             0x000000010e331daf main + 111\r\n\t15  libdyld.dylib                       0x0000000113a6492d start + 1\r\n)\r\nlibc++abi.dylib: terminating with uncaught exception of type NSException\r\n```\r\n\r\nAfter stepping through the code, it appears that this is because the `scopeParamterFromOptions` method returns a nil if no scope is provided.\r\n\r\nProviding an empty string for the scope parameter prevents the crash:\r\n```\r\n      lock.delegation({\r\n        token: token,\r\n        api: \"firebase\",\r\n        scope: \"\"\r\n      }, (a,b,c) => {\r\n        console.log(\"delegation callback\",a,b,c);\r\n      });\r\n```\r\nBut this still doesn't work - Auth0 calls my callback with the error `Request failed: bad request (400)`.  I can't see any documentation for what should go in the scope parameter for a request for a firebase token."}}