Last active
December 8, 2015 13:39
-
-
Save matthewjackowski/87f9c65f2332e2bab504 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def handleAuthError | |
| puts 'Put error handling code here' | |
| end | |
| project_params = { | |
| slug: "test-#{SecureRandom.uuid}", | |
| description: 'wpml_project', | |
| organization: user_data[:org_slug], | |
| :private => true, | |
| source_language_code: 'en', | |
| name: "Test project-#{SecureRandom.uuid}" | |
| } | |
| begin | |
| project = Transifex::Projects.create(project_params) | |
| project.fetch | |
| rescue => e | |
| handleAuthError if e.message.include? 'Authorization Required' | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, I agree the intent is to use a single set of credentials at a time. Using security credentials between multiple systems is very problematic with just username and password and can often result in these values being stored remotely without the users knowledge. A better solution is to us a Auth protocol like OAuth which works off of tokens that a user can revoke.
Although, I'm not sure I understand why you need to authenticate as multiple different users. It's really difficult for me to understand what you are trying to accomplish without seeing the code that you are referencing.