Comments (4)
Hi @aasatt, the LoginButton is actually designed to work for exactly this case. You just need to add logic to your loginCompletion closure to handle both the Native and AuthorizationCode login types. If the login using Native fails, it will fallback to using AuthorizationCode.
So, in your loginCompletion, you just need to check for an accessToken first (which will be there if Native succeeded). Otherwise, the completion will be called with no accessToken and no Error once the user has logged in on the AuthorizationCode grant login page. (which your code seems to be handling).
To do this, you will have to make use of the multiple UberCallbackURIs
key in your .plist, for example:
<key>UberCallbackURIs</key>
<array>
<dict>
<key>UberCallbackURIType</key>
<string>AuthorizationCode</string>
<key>URIString</key>
<string>https://myoauthserver.com/authorize</string>
</dict>
<dict>
<key>UberCallbackURIType</key>
<string>Native</string>
<key>URIString</key>
<string>sampleApp://native</string>
</dict>
<dict>
<key>UberCallbackURIType</key>
<string>General</string>
<key>URIString</key>
<string>http://someothercallback.com</string>
</dict>
</array>
Which will tell the SDK which URIs to use for the different login types.
To address your notes:
- That is strange, do you have the scopes you are requesting enabled on your developer dashboard? If you are signing in with the same account that is registered on the dashboard, you should be able get scopes that you aren't approved for yet (to allow testing). However, it looks like there is currently a problem with that functionality for privileged scopes obtained via Native login, which we are currently investigating.
- You can save accessTokens manually using the
TokenManager.saveToken(accessToken:)
method. So once you get the access token string from your OAuth server, you can just callTokenManager.saveToken("myAccessToken")
and the token will be saved and used for future requests
from rides-ios-sdk.
see #45 regarding your first note
from rides-ios-sdk.
@jbrophy17 Great. It does only seem to be an issue with the native login. This not working was definitely a source of confusion. Thanks again for your help and for clearing things up. I think I have it working how I want it now.
from rides-ios-sdk.
No problem, sorry for the confusion!
from rides-ios-sdk.
Related Issues (20)
- Add multiple stops
- Detecting when user taps on the rider button HOT 1
- Authorization Error HOT 1
- using gesture recognition to press button (Question)
- fetchRideRequestEstimate need client token ?
- Cocoapods: Version 0.12 podfile HOT 2
- User cancelled the login process iOS 13
- LoginManager.executeNativeAuthenticators returns `nil` error on iOS 13 HOT 2
- iOS 13 support... New release anytime? HOT 12
- Accessing Uber History Scope
- "Please reach out to your Uber Business Development representative for server token access" HOT 2
- Crash on launch of app on iPhone 5 devices
- Error Domain=com.uber.rides-ios-sdk.ridesAuthenticationError Code=19
- Server tokens ungeneratable HOT 2
- Bitcode Processing failed
- App Privacy Details (aka Nutrition Labels) information/policy for the SDK HOT 2
- CocoaPods install Xcode 12.4
- "User cancelled the login process" HOT 1
- Manual installation trouble
- Commuters
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rides-ios-sdk.