{ "id": "167086", "key": "TIMOB-24576", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "19405", "name": "Ti.OAuth 0.4.0", "archived": false, "released": true, "releaseDate": "2017-04-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-04-14T13:38:11.000+0000", "created": "2017-04-12T18:21:41.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "APIM+" ], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-08-06T17:49:22.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "The redirect_uri from the ti.oauth module is hardcoded to http://localhost/Callback, A fix has to be made to fix ti.oauth module to accept custom redirect_uri.\r\n\r\nDownload Titanium SDK from API Portal (https://lphxen013.lab.phx.axway.int/index.php?option=com_apiportal&view=apitester&usage=api&tab=tests&Itemid=0&apiName=studentcar&apiId=35d9091f-19cb-431a-b8f1-427f25a929e6) user/pwd: hod/changeme.\r\n\r\nFollow the instructions in the Readme to created an AlloyApp.\r\n\r\nCopy this in the \r\nvar sdk = require('./studentcar');\r\nvar SDKClient = new sdk.Client();\r\n\r\n// Set up client secret\r\nSDKClient.authentications.set('client_id', '53c0cd50-e8be-4ab5-af50-c1e5f3af3be3');\r\n\r\nSDKClient.authentications.set('client_secret', '50e2f47e-a2c6-467c-92c4-57cbc19051ed');\r\nSDKClient.authentications.set('redirect_uri', 'https://lphxam004.lab.phx.axway.int/oauth_callback');\r\nSDKClient.authentications.set('response_type', 'token');\r\n\r\n\r\nvar OAuth = new sdk.OAuth();\r\n// For self sign certificate\r\nOAuth.ignoreSslError = true;\r\n// Make global instance\r\n\r\nAlloy.Globals.OAuth = OAuth;\r\nAlloy.Globals.API = new sdk.DefaultAPI(SDKClient);\r\nAlloy.Globals.SDKClient = SDKClient;\r\n\r\nIn the Client.js update authorizationURL from http to https.\r\n\r\nRun the app in emulator. it is pointing to http://localhost/Callback, this value should accept custom redirect uri.\r\n", "attachment": [], "flagged": false, "summary": "Ti.OAuth: Redirect URI is hardcoded", "creator": { "name": "skchkadiyala", "key": "skchkadiyala", "displayName": "Suman kalyan chowdary Kadiyala", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "skchkadiyala", "key": "skchkadiyala", "displayName": "Suman kalyan chowdary Kadiyala", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "417344", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "I think it was set to that value on purpose by [~cwilliams], because developers usually set their own one per project. As this a special use-case for the client-generator, I understand it should be configurable. Let me do a PR for that today. We might want to refactor it soon to split out the different OAuth-options into own files and/or write an Alloy widget for it.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-04-13T07:49:44.000+0000", "updated": "2017-04-13T07:49:44.000+0000" }, { "id": "417346", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator-modules/ti.oauth/pull/6\r\n\r\nExample:\r\n{code:js}\r\nvar OAuth = new sdk.OAuth();\r\n\r\n// Configure callback-url (optional, defaulting to http://localhost/Callback)\r\nOAuth.redirectUrl = 'http://example.com/callback';\r\n\r\n// Configure window-appearence (optional)\r\nOAuth.authWindowOptions = {\r\n title: 'OAuth'\r\n};\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-04-13T08:09:40.000+0000", "updated": "2017-04-13T08:13:28.000+0000" }, { "id": "417377", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "You set the window options and callbackUrl on the OAuth class/object itself, and not on an \"instance\" - you get an instance back as a result of the authorize* method calls and it contains the tokens needed.\r\n\r\nI think they wrap the ti.oauth module in their own wrapper in the generated sdk clients, so I assume there's more changes necessary to the titanium templates to expose these values. In the client-generator/templates/titanium/oauth.js you'd call:\r\n{code:javascript}\r\nvar oauth = require('ti.oauth');\r\n//...\r\noauth.default.callbackUrl = 'http://www.example.com/callback';\r\noauth.default.authWindowOptions = {\r\n title: 'OAuth'\r\n};\r\n{code}", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2017-04-13T18:30:39.000+0000", "updated": "2017-04-13T18:30:39.000+0000" }, { "id": "440133", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-06T17:49:22.000+0000", "updated": "2018-08-06T17:49:22.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }