Closed chaseklingelzen closed 7 months ago
That certainly looks right to me -- can you share the code you're using to generate the Link token?
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:
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.
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 (ins117181). 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!
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?
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"],
}
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.
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
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.
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.
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!
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. :)
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
A detailed description of the steps to reproduce the issue
When selecting Platpus OAuth Bank (or any bank for that matter), we see the following warning banner:
We have configured our redirect uri in the Plaid dashboard.
Assume that our uri is the following:
https://mycompany.com/n/native-oauth-plaid-link-completed
in Xcode, we have set up applinks like so:
When we create the link token we pass the redirectUrl "https://mycompany.com/n/native-oauth-plaid-link-completed".
We have an apple-app-site-association file being hosted. Here is the basic outline of our apple-app-site-association:
What you expected to see?
I expected that our redirect uri was set up correctly and the banner in the screenshot above stating we have a missing redirect_uri is not present.
What you saw instead?
The banner saying we have potential issues with our redirect_uri.
When submitting an issue for Link on the web or within a Webview, please include the following information:
N/A
When submitting an issue for Plaid Link iOS please include the following information:
env
Note: This happens on both physical device and simulators of various versions and device types.
List of used 3rd party libraries (e.g. CocoaPods):