Code Monkey home page Code Monkey logo

Comments (12)

ToddKerpelman avatar ToddKerpelman commented on June 13, 2024

That certainly looks right to me -- can you share the code you're using to generate the Link token?

from plaid-link-ios.

chaseklingelzen avatar chaseklingelzen commented on June 13, 2024

Hi Todd, trying to determine what code would be most helpful to share. I assume you'd want to see the server side code that generates the link token?

I think the main questions I'm looking to get answered here are the following:

  1. Does this warning mean we will run into issues in production? If so, can you outline what those issues would be? I assume app 2 app flows would not work.

  2. Is it possible to test app2app flows on mobile in a sandbox environment (i.e. our dev environment)? I found this documentation stating the following:

You can test OAuth on Sandbox even if Plaid has not yet enabled OAuth flows for your account. To test out the OAuth flow in the Sandbox environment, you can use Platypus OAuth Bank (ins_127287), Platypus OAuth App2App Bank (ins_132241) for testing App2App flows on mobile, or to emulate European flows, Flexible Platypus Open Banking (ins_117181). These dummy institutions direct you to a Plaid sample OAuth flow that is similar to what you would see for a bank’s OAuth flow. When prompted, you can enter anything as credentials (including leaving the input fields blank) to proceed through the sample OAuth flow. Note that institution-specific OAuth flows cannot be tested in Sandbox; OAuth panes for Platypus institutions will be shown instead.

I have tried using both Platypus OAuth Bank and Platypus OAuth App2App Bank in our dev environment and I remain in a webview on top of our current application.

I then found this documentation, which seems to state you can't actually test app2app flows in sandbox:

If using webviews, App-to-App support is not automatic; for an App-to-App experience, it is strongly recommended to use a Plaid mobile SDK instead.
The full App-to-App flow cannot currently be tested in the Sandbox environment. In Sandbox, all OAuth flows will appear as a webview on top of your current application. It is recommended to test iOS App-to-App flows on physical devices, as some customers have reported issues with testing Universal Links flows on iOS simulators.
Chase is currently the only bank that supports App-to-App authentication on Plaid.

So, any clarification here would be greatly appreciated!

from plaid-link-ios.

ToddKerpelman avatar ToddKerpelman commented on June 13, 2024
  • Yep -- the server side code that generates the Link Token. (Specifically, I'm wondering if the redirect_uri is in the wrong place or there's something else funny with it)
  • The warning does basically mean that the app2app flow won't work in production, assuming you're building a native iOS app. This primarily affects Chase at the moment, but supporting it will help conversion there.
  • At the moment, the app2app flow cannot be tested on sandbox. The team is looking to add support for it soon, but in the meantime I'll go ahead and update that first link to make that clearer.

from plaid-link-ios.

chaseklingelzen avatar chaseklingelzen commented on June 13, 2024

I'll have to double check with my team that I can share the server side code here. Will get back to you on that tomorrow. Thanks @ToddKerpelman.

So, if we do not see the redirect_uri banner any longer, we can safely assume the app2app flow is working? Is that the only sort of "signifier" that things are working in sandbox?

from plaid-link-ios.

chaseklingelzen avatar chaseklingelzen commented on June 13, 2024

Hi @ToddKerpelman, please let me know if this snippet gives you enough information:

def create_link_token(
    account_uuid: str,
    account_filters: Dict[str, Dict[str, List[str]]],
    link_customization_name: str,
    redirect_url: str = None,  # note it's my understanding that we are passing a value here.
    products: List = None,
    plaid_access_token: str = None,
    account_selection_enabled: bool = False,
    android_package_name: str = None,
) -> Dict[str, str]:
    """
    Creates a link token for the given account id and returns the link token

    @param account_uuid: the account id for which the link token is being created
    @param account_filters: the account filters for the link token
    @param link_customization_name: the name of the link customization
    @param redirect_url: the redirect url for the link token
    @param products: the products for the link token
    @param plaid_access_token: the plaid access token for the link token
    @param account_selection_enabled: whether the account selection is enabled
    @param android_package_name: the android package name

    @return: the link token
    """
    ... // not important, but can provide if required 
    
    conditional_args = {}
    ... // not important, but can provide if required 
    
    # The name of your app's Android package. Required if using the `link_token`
    # to initialize Link on Android. Any package name specified here must also
    # be added to the Allowed Android package names setting on the
    # [developer dashboard](https://dashboard.plaid.com/team/api).
    # When creating a `link_token` for initializing Link on other platforms,
    # `android_package_name` must be left blank and `redirect_uri`
    # should be used instead.
    if android_package_name:
        conditional_args["android_package_name"] = android_package_name
    elif redirect_url:
        conditional_args["redirect_uri"] = redirect_url

    plaid_request = LinkTokenCreateRequest(
        client_name="MyCompany",
        country_codes=[CountryCode("US")],
        language="en",
        user=LinkTokenCreateRequestUser(client_user_id=account_uuid),
        webhook=settings.PLAID_WEBHOOKS_URL,
        **conditional_args,
    )

    token_response = client.link_token_create(plaid_request)
    
     except Exception as exc:
        logger.exception(
            f"Plaid error LinkTokenCreate for account: {account_uuid}. Detail: {exc}"
        )

    if "link_token" not in token_response:
        logger.error("Link token not found")
        raise InvalidTokenError()

    return {
        "expiration": token_response["expiration"],
        "link_token": token_response["link_token"],
        "request_id": token_response["request_id"],
    }

from plaid-link-ios.

ToddKerpelman avatar ToddKerpelman commented on June 13, 2024

That looks good, although there's no chance you're passing in both the Android package name and the redirect_url in the same call, is there? (Because if you include the first, it won't set the latter.) If that looks okay, I might try logging the values of your conditional args to make sure those really are getting set properly.

And if that still looks like your setting your values okay, I might file a ticket with support. They might be able to find something that I can't.

from plaid-link-ios.

ToddKerpelman avatar ToddKerpelman commented on June 13, 2024

So, if we do not see the redirect_uri banner any longer, we can safely assume the app2app flow is working? Is that the only sort of "signifier" that things are working in sandbox?

Actually, the bigger thing to check would be that Universal Links are working, and that opening up that URL on an iOS device (or the simulator) actually opens up your app. I go into details on how to test that here

from plaid-link-ios.

chaseklingelzen avatar chaseklingelzen commented on June 13, 2024

That looks good, although there's no chance you're passing in both the Android package name and the redirect_url in the same call, is there? (Because if you include the first, it won't set the latter.) If that looks okay, I might try logging the values of your conditional args to make sure those really are getting set properly.

And if that still looks like your setting your values okay, I might file a ticket with support. They might be able to find something that I can't.

My understanding is we should only be sending the redirect_url if the client is iOS, but we will triple check that. Sounds good on filing a ticket if we continue to hid a roadblock there.

from plaid-link-ios.

chaseklingelzen avatar chaseklingelzen commented on June 13, 2024

So, if we do not see the redirect_uri banner any longer, we can safely assume the app2app flow is working? Is that the only sort of "signifier" that things are working in sandbox?

Actually, the bigger thing to check would be that Universal Links are working, and that opening up that URL on an iOS device (or the simulator) actually opens up your app. I go into details on how to test that here

Makes sense on this! I did see that in the video you posted. I was doing some testing around this today actually. I did have one question here:

Should we be removing "www" from our redirect uri in the plaid dashboard or does it not really matter (e.g. "https://mycompany.com/n/native-oauth-plaid-link-completed" vs. "https://www.mycompany.com/n/native-oauth-plaid-link-completed")

Main reason I ask is because I saw "Constructing valid redirect URIs" section here and it does seem like in every example "www" is excluded. For the record, we have tried both with "www" and without. I'm just curious to get more information here.

from plaid-link-ios.

chaseklingelzen avatar chaseklingelzen commented on June 13, 2024

Hi @ToddKerpelman,

Wanted to follow up here. The root cause of our issue was actually on our server side logic. We were not passing the redirect_url properly to that python method I mentioned.

For anyone else who finds this thread, it was important that the redirect url we defined in Plaid's dashboard match exactly what we sent to generate the link token.

Example:

redirect uri defined in plaid: "https://www.mycompany.com"
redirect uri sent from iOS client to server ultimately to plaid must be: "https://www.mycompany.com"

If you omit the "www" in the redirect uri you send from the client but defined "www" in the plaid dashboard, it will not work.

Side note @ToddKerpelman - I built my first ever iOS app with Firebase and utilized a lot of the videos you created to make that happen. You're an incredible teacher and I really appreciate the content you've created over the year. Plaid is in good hands!

from plaid-link-ios.

ToddKerpelman avatar ToddKerpelman commented on June 13, 2024

Hooray! Glad you were able to get your issue sorted out. And thanks so much for the kind words! Glad you found those videos helpful. :)

from plaid-link-ios.

chaseklingelzen avatar chaseklingelzen commented on June 13, 2024

Also, important here. Make sure that if you use "www" in your redirect_uri that your app links defined in your associated domains in xcode also includes "www" or it will not work.

Example:

applinks:www.mycompany.com

from plaid-link-ios.

Related Issues (9)

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.