Closed stoicflame closed 9 years ago
The authenticateviaoauth2 works in the sandbox. The request goes to https://sandbox.familysearch.org/cis-web/oauth2/v3/token. The request in production goes to https://familysearch.org/cis-web/oauth2/v3/token and gets 404 . My guess would be there is a link in the sandbox that doesn't exist in production. I was able to create a hack to make it work in production for now.
I saved out the baser of the embedded client in the familysearch object.
string rc = Program.ft.Client.BaseUrl;
if the connection is for production I set the baseurl to the base of the token link if (!Program.useSandbox) { Uri urx = new System.Uri(Program.ft.GetLink(Rel.OAUTH2_TOKEN).Href);
Program.ft.Client.BaseUrl = urx.GetBaseUrl();
}
after the authentication call, I restore the baseurl if it is production.
if (!Program.useSandbox)
{
Program.ft.Client.BaseUrl = rc;
}
See pull request https://github.com/FamilySearch/gedcomx-csharp/pull/31. This is my proposed solution.
Merged #31.
If a resource links to a resource at a different domain, the request attempt will be made to the domain of the source resource.
For example, when an attempt to authenticate in production to an instance of
FamilySearchFamilyTree
, the Family Tree state is at "https://familysearch.org/platform/collections/tree" and the link to the OAuth 2 authentication resource is at "https://ident.familysearch.org/cis-web/oauth2/v3/token", but theAuthenticateViaOAuth2
method attempts to authenticate to "https://familysearch.org/cis-web/oauth2/v3/token" and not "ident.familysearch.org".@shanewalters, I would appreciate any advice you can provide to fix this issue.