Rails credentials only remembering old credentials? - ruby-on-rails

Issue: I created a new Stripe account and connected it to my application, did all the new test publishing and secret api keys... Added to my credentials and config.
All of my keys are successfully called with :
Rails.application.credentials.dig(:stripe, :publishable_key),
...in both config and stripe.js file
I update my keys in credentials and make a test payment and get
No such token: tok_1EKxxxxxxxxxxxhQKy
I then manually put in the new publishable key in the stripe.js file, and it works...
To test, I tried entering the old test key, and i get the same errors. So i am assuming the credentials dig is getting my old keys because its the same error?
Is it possible the credentials is somehow not updating?
Now, one issue i can think of is, in the past i used atom to update my credentials, and it never worked. I recently came across a post hat atom doesn't work with credentials but nano does. So i implemented this and it worked (up until i entered new keys in). So i am wondering if my old inputs into the old atom credentials could be interfering? I doubt it but might be worth mentioning
What could be done to fix this as i want to implement using credentials?
All of the keys are test keys and in their right places.
I'm assuming, in the stripe.js file, the credentials or the dig is only fetching the old key?
Because when i manually put in the old test key, it doesn't work with same error as the credentials dig.
This was all working fine until i updated the credentials for the new keys...

Spring cached credentials file.
Run this command:
spring stop

Related

GitHub pull request builder unable to connect to GitHub

Good afternoon.
I'm using plugin version 1.42.0.
Recently I receive a token deprecation notice in my mailbox. I regenerated the token and now I'm not able to connect to Github at all through this plugin.
I tried different types of credentials - email + password, secret text, email + password (where the token is the password), no luck.
Please note that credentials are valid, I'm able to connect to GitHub through other plugins.
Am I missing something very obvious here?
PS. No 2-factor auth is enabled for my account.
I'm not an admin account, but I'm able to read and write everything into the repo.
Well, my bad.
I was so tired, that I did not put a repository name into the field above.
Everything is working now.

oAuth with Azure Active Directory fails due to [AADSTS50012: Invalid client secret is provided]

I'm implementing a webapp that connects to Dynamics365 via webapi. Therefore I'm using Azure Active Directory for oAuth. I'm getting the following error and I'm not sure where is something going wrong. Therefore I'm describing my whole procedure:
"error":"invalid_client",
"error_description":"AADSTS70002: Error validating credentials. AADSTS50012: Invalid client secret is provided.
Trace ID: 2cc92fcd-798b-4636-892d-0c3c397c0401
Correlation ID: f3bd2f4c-05c5-4de8-ace2-acf4b99e6fb9
Timestamp: 2018-09-19 09:43:38Z",
"error_codes":[70002,50012],
"timestamp":"2018-09-19 09:43:38Z",
"trace_id":"2cc92fcd-798b-4636-892d-0c3c397c0401",
"correlation_id":"f3bd2f4c-05c5-4de8-ace2-acf4b99e6fb9"
I'm using these urls including the tenant. I got got them from the Azure Portal / Azure Active Directory / App Registration:
https://login.microsoftonline.com/{tenant}/oauth2/authorize
https://login.microsoftonline.com/{tenant}/oauth2/token
I registered a new app in the App Registration. I used the app ID and created a key that I used as client_secret. Calling the authorize-url is working fine! Then it is redirected to my callback.
Then I'm getting a code that I try to use to get a token. But it returns the error mentioned above. Input for POST-request to /oauth2/token is the following:
grant_type=authorization_code&
client_id={same as for authorize}&
code={returned code from authorize}&
redirect_uri={the callback of my webapp}&
resource={also callback-url}&
client_secret={the key from the keys-section in App Registration}
I'm looking forward to any ideas!
A few things you can try:
As Sunny suggested in the comments, a simple step would be to create a new key in the app registration and try that one.
Make sure that you have the Client Secret in your config or app settings matches exactly what you have in the portal. Also make sure that you don't somehow have duplicate app settings that could be overwriting each other.
From this similar discussion on MSDN:
Go to https://identity.microsoft.com login, and then select your app.
Click on "Generate New Password"
Use that value as the client_secret parameter.

Unable to create oauth client ID (google developer console)

I am including sign in via google functionality in my app, for which i had created oauth client id keys for both of my debug and release mode, but since everything was not working properly so, i thought of deleting and re-creating it again, so i deleted both the keys but now when i trying to create the new keys it gives me error as
Duplicate fingerprint
The fingerprint you specified is already used by an Android OAuth2 client ID in this project or another project
but i had deleted both the key's, i had tried all the solution that are already present in stack overflow, like going into the old console portal etc. but none is helping me out,please help me with the issue
Did you try to go to your API console and UNDELETE your old projects? When you delete a project in the API console, the oauth IDs associated with it seems to not get deleted with it. I undeleted every single one and went through them and removed all associated APIs. Once I cleared out the past projects, I re-deleted them and added the oauth again to my new/safe project and it was OK.
Your problem seems to be little different, so you can look for different solutions here, as it's a common problem:
https://code.google.com/p/google-plus-platform/issues/detail?id=554

Bad Authentication Error Rails connecting to google drive

I have a contacts controller which has a method to connect and save the data submitted from the form to a spreadsheet in my account on google drive (app/models/contact.rb):
def update_spreadsheet
connection = GoogleDrive.login(ENV["GMAIL_USERNAME"], ENV["GMAIL_PASSWORD"])
ss = connection.spreadsheet_by_title('Learn-Rails02-Example')
if ss.nil?
ss = connection.create_spreadsheet('Learn-Rails02-Example')
end
The method calls on environment variables I set up with figaro which are saved config/environments/development.rb as follows:
GMAIL_USERNAME: tgolsby#gmail.com
GMAIL_PASSWORD: Paxxword (obviously this is a place holder for my actual password in the .yml file)
When I submit my form I get the following error:
*GoogleDrive::AuthenticationError at /contacts
Authentication failed for tgolsby: Response code 403 for post https://www.google.com/accounts/ClientLogin: Error=BadAuthentication*
It points to the following line in the contacts model:
*def update_spreadsheet*
**connection = GoogleDrive.login(ENV["GMAIL_USERNAME"], ENV["GMAIL_PASSWORD"])**
*ss = connection.spreadsheet_by_title('Learn-Rails02-Example')
if ss.nil?
ss = connection.create_spreadsheet('Learn-Rails02-Example')
end*
I have checked and rechecked my username and password and am 100% sure they are correct in the application.yml file. I have gone through the tutorial and repeated all the steps but I just cant' figure out why the app is having trouble connecting to google. I have also checked that I don't have 2 step verification set up on my google account.
You might have the same issue I had. I was accessing my google doc using the google_drive gem on a personal project I had not touched in over a year. I used to be able to access my google doc by enabling a session using session = GoogleDrive.login('rosalyntest1#gmail.com', 'password') but was now getting the same error as you.
I logged into that account using my password and saw an email from google with a subject of "sign in blocked." I followed the link https://www.google.com/settings/security/lesssecureapps to enable less secure app access for that account only and was able to enable a session locally using the same code. I would check your google account and see if you received an email or enable less secure app access and try again.
The code is good (you can check it against the learn-rails example application). It looks exactly like the code from the Learn Ruby on Rails book.
That means the problem is a result of an environment or configuration issue.
First, are you running locally, or do you have the problems after deploying to Heroku?
If running locally, here are things you can try to troubleshoot:
1) Try restarting the web server. When you change configuration files, the server has to be restarted.
2) Replace ENV["..."] in the code and use the credentials directly ("hardcode the credentials"). Be careful not to check the code into the git repo with the hardcoded credentials (and don't push to GitHub because you would expose your credentials).
3) Can you send email from the application? Comment out the code that updates the spreadsheet and you should be able to send email if your credentials are correct.
I had this problem as well, and I was able to fix it by making the ENV["GMAIL_PASSWORD"] code in my contacts model all caps just as it is in my environment. It was not working when I only had the first letter caps in the code but everything in caps in the env variable, so be sure to consider the case sensitivity of your environments.

BlackBerry application code signing problem

I want to sign a BlackBerry application with the 3 CSI files I have. When I install new keys, I give the associated user id and password, but I am getting this error:
Unable to register a client bearing no
175534 because there are no more
registration attempts. If you have
already registered with this server
then you must contact RIM to register
additional users.
Can anybody tell what is next step that I need to do?
The error message seems pretty clear on the next step:
.. you must contact RIM to register additional users.
The official response from blackberry support:
Hello,
Thank you for contacting BlackBerry Application Development Support.
This error means the keys have already been registered so cannot be registered again. To have this issue resolved a new set of signature keys will need to be issued and installed. Please note that signature keys are now completely free and issued several times a day, so the fastest way to get a new set would be to place a new order:
https://www.BlackBerry.com/SignedKeys
Prior to installing this new set of keys please first delete all present CSI files as well as the sigtool.* (DB, CSK, SET) files that will reside in the sub-directories of all development tools. Make sure to write down the PIN used to place the order as well, it will be needed when installing the keys.
After registering your keys and verifying that they are able to sign I would recommend backing them up some place safe in case anything should happen to your development environment:
http://supportforums.blackberry.com/t5/Testing-and-Deployment/Backup-and-Restore-BlackBerry-Code-Signing-Keys/ta-p/837925
Go to the first URL and request a new set of keys. You should get an order confirmation email right away. In about 1-2 hours you will get 3 more emails. Each one will have a CSI key attached. (The keys are free to generate)
To avoid this issue in the future, you can back up the keys, according to the instructions in the second link (above).
Good luck!

Resources