Code Monkey home page Code Monkey logo

Comments (4)

jbrophy17 avatar jbrophy17 commented on July 17, 2024

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:

  1. 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.
  2. 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 call TokenManager.saveToken("myAccessToken") and the token will be saved and used for future requests

from rides-ios-sdk.

jbrophy17 avatar jbrophy17 commented on July 17, 2024

see #45 regarding your first note

from rides-ios-sdk.

aasatt avatar aasatt commented on July 17, 2024

@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.

jbrophy17 avatar jbrophy17 commented on July 17, 2024

No problem, sorry for the confusion!

from rides-ios-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.