UnauthorizedException token_rejected - xero-api

I am using the Demo company to develop.
The company expired so I re-activated it
However when I try to run my unit test to connect to a table I get the following error
Xero.Api.Infrastructure.Exceptions.UnauthorizedException:
oauth_problem=token_rejected&oauth_problem_advice=
The%20organisation%20for%20this%20access%20token%20is%20not%20active
I decided to try and regenerate the keys.
When I go to the App page in developer.xero.com and select the option to do this I get a question
Regenerate Keys?
Are you sure you want to regenerate your application keys?
This will break any instance of the application using the old key and secret.
I answer Yes, then an error appears briefly at the bottom of the screen in red.
Error! Please refresh
The dialog does not close.
The keys do not re-generate.
I am using Chrome as the browser on Win 10

Re-generating the demo organisation actually creates a whole new organisation; because of this, your app is still linked to an expired demo organisation, so it won't get new keys.
I think you'll need to create a new app to be able to use your new demo organisation.

Related

Service settings

I have a service, written in VB, with some user settings. Two of these are an oauth access / refresh token, and I need to keep storing the new token, so whenever that is updated, I write the settings away again.
Can anyone tell me where those settings are stored on my PC? I can see that the app.exe.config file is not being updated, and it's not being read when I start the service. I don't have a folder in users\username\appdata\local for the service name, nor in roaming, nor in locallow.
I tried using installutil to uninstall and re-install my service, hoping that might cause it to use the settings in app.exec.config, but it did not, it's still trying to use a token that's long out of date from somewhere.
If I paste a new token pair into my app.exe.config, I can see that the service is not reading it. It is reading an old token from when I was last working on it / testing it, and getting an expiry error because I've used a new token pair in a desktop test version of the app.
I seem to be going round and round in circles trying to find where these settings are stored. The annoying thing is that I've had it working, and "sometimes" it will pick up the new token and everything works. But I soon need to install it on the customers PC, and I'm concerned that I'll have another fruitless morning of it using old tokens and not being able to renew them. I'm sure this is something I just don't understand, but I'd rather not go to storing them in a local file if I don't have to. The first answer that comes up on here reveals that others have similar issues and generally resort either to their own storage or the registry, but it is an 11-year-old answer. I'm using VS 2019, if that makes any difference.
This is the code I use to store the new token away, if it helps:
My.Settings.RefreshToken = newToken ' this is returned in the refresh request
My.Settings.Save
When my code opens, it loads the settings in a similar way:
accessToken = My.Settings.AccessToken
refreshToken = My.Settings.RefreshToken
tokenExpires = My.Settings.Expiry
Even if I edit my app.exe.config file to contain "*" in the expiry field, it is still somehow finding the expiry date/time from the previous time the service successfully ran. So it clearly isn't retrieving the information from that file any more.
To close this off, the comment by #Jimi earlier on held the key. The settings that are updated by the service are stored in a file called user.config which in my case is in c:\windows\syswow64\config\systemprofile\appdata and then my application name.

Empty Query Results after switching API KEY - CA Agile Rally API

I'm running into a strange issue where I'm getting no results from queries to the CA Agile Rally API after switching to a new API key. Both API keys are created on subscription admin accounts and the queries are exactly the same so I'm not sure why I would have this issue.
It is really the strangest thing and I'm not sure how to troubleshoot it further. The issue only seems to affect queries that return 1 result (i.e query by ObjectID/ObjectUUID). Other queries with more than 1 result seem to be working as expected (unless it's an OR query with multiple ObjectID/ObjectUUIDs). I've also confirmed that I can get/update the artifact using the ref without a problem. When I switch back to my old API key and run the exact same query I get the desired result.
I'm using this package but I've also tested with my own Node JS request API calls and I have the same problem. What could I be missing here?
Needed to give the user a default workspace/project and it resolved the issue.

Mac App Sandboxing- Updating files outside the sandbox

I have an Application for the Mac that I want to publish on in the app store.
I order to get it published I need to put in a sandbox.
The app access Sqlite files outside the sandbox which the user selects from a openpanel.
The App works fine when is performs a select but it fails on inserts and updates.
I can remember reading something about some function you could call that could give you write access to files outside the sandbox but for the life I can remember what is was Can anyone enlighten me ?
Regards Christian Arild Stœr Andersen
Add "com.apple.security.files.bookmarks.app-scope" with boolean value YES in entitlement file of your project. Add follow "With Sandboxing" section of this link --
http://cocoaintheshell.com/2012/09/saving-sandboxing/
When you resolve your URL, by using URLByResolvingBookmarkData: method, you will get the url something like this --
file://localhost/Users/XYZ/Downloads/MyAudio.mp3?applesecurityscope=353734653735396237656239646134396537363331633063393765356234363035353666326332393b30303030303030303b3030303034534534343030303032303b636f6d2e6170706c652e6170702d73616e64626f782e726561642d77726974653b30303030303030313b30313030303030323b303030303030303030303035633134613b2f75736572732f69706874656368322f646f776e6c6f616473
For more information search for -- "NSURLBookmarkCreationWithSecurityScope"

NO identities from the profile issue

Hey I have a new machine on which I am installing my provisioning certificate and provisioning profile. When I set the code sing is show that No identities from the profile. I am doing it first time. I do not know why it is not showing the signing identity. Is it developer account issue or any thing else.
Thanks
Your question is a little bit unspecific, for people to help you. But lets give it a shot.
1.) Make sure the profisioning profiles are valid for your App (especiall look at the bundle identifier - the must match, or the profile must end with a '.*')
2.) In Xcode 5 goto Preferences / Accounts / View-Details and press the Sync button. If your profiles show up there it should work and they show up in the build settings. (Attention if you are still with Xcode 4, the profiles dialog is somewhre in the Organizer window)
If this brings you one step further, please mark question solved. IF further problems exist, create a more specific question.

invalid_client in google oauth2

I try to make a web page for youtube video upload, therefore I try to get the client id from google api console, and in the api console it shows something like this:
Client ID: 533832195920.apps.googleusercontent.com
Redirect URIs: http://bobyouku.ap01.aws.af.cm/testyoutube.php
https://developers.google.com/oauthplayground
However when I try to test my account using the following URL:
https://accounts.google.com/o/oauth2/auth?client_id=533832195920.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Fbobyouku.ap01.aws.af.cm%2Ftestyoutube.php&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube&response_type=code&access_type=offline
It gives out the result of invalid_client. Even when I try it on oauth2 playground, same fail occurs
So anyone knows what's happen?
Set/change your product name, I had this issue until I created a product name as same as project name.
The product name can be set in the Consent screen section of the Google Developers Console for your project. Look under APIs & auth in the left navigation and select Consent screen.
You need also to set your email address in the box above the product name.
After copy values from Google web UI, I had a blank space for:
client_id
secret
And at the BEGINNING and at the END for both.
This happens even when clicking on the "copy" button.
Trim the leading and trailing white space from both the client_id and client_secret. Google's copy button does not do this for you.
Set both the email address and product name fields for the OAuth consent screen.
Setting EMAIL ADDRESS and PRODUCT NAME in the consent screen of Google developer console, solves the error "Error: invalid_client. The OAuth client was not found." for me.
I had .apps.googleusercontent.com twice in my ID.
It was a copy and paste issue "Your ID HERE".apps.googleusercontent.com
invalid_client can also simply means that your client ID and client secret are wrong when you create your Oauth2 object.
in this thread i found my answer.
I went to google console,
generate a new project, made refresh, because in my case after create the page didn't reload
select new project
create a client ID
use it for what you need
thanks guys :D
In my case this turned out to be something else, namely my code used an environment variable that hadn't been set properly (and stupidly wasnt checked by my code). Setting it, recompiling assets, and restarting the app did the trick.
If you follow the documentation, from this page
https://developers.google.com/identity/sign-in/web/sign-in#specify_your_apps_client_id
you'll see
<meta name="google-signin-client_id" content="YOUR_CLIENT_ID.apps.googleusercontent.com">
But it's wrong. It should be
<meta name="google-signin-client_id" content="YOUR_CLIENT_ID">
The issue is that the '.apps.googleusercontent.com' gets added anyway. If you do it like the documentation says, you get '.apps.googleusercontent.com' twice
I solved this by removing unnecessary quotes from my clientID and clientSecret values.
Did the error also report that it was missing an application name? I had this issue until I created a project name (e.g. "Project X") in the project settings dialog.
probably old credentials are invalid
see the answer below
stackoverflow answer
or short names may work
see the answer below
stackoverflow answer
or product name same as project name as answered already
at times one may include extra space in the
check twice this line so that you are redirected to the correct url
I solved my problem with trim :
'google' => [
'client_id' =>trim('client_id),
'client_secret' => trim('client_secret'),
'redirect' => 'http://localhost:8000/login/google/callback',
],
None of the following were my issue - I resolved this by opening an incognito window. Something was obviously being cached somewhere, no amount of changing auth client settings helped and there were never any trailing or leading spaces in config values.
Check your Project name on Google APIs console.
you choose another project you created.
I was same error.
my mistake was choosing diffirent project.
At Credentials
Accept requests from these HTTP referrers (web sites) (Optional)
Use asterisks for wildcards. If you leave this blank, requests will be accepted from any referrer. Be sure to add referrers before using this key in production.
Add . (star dot star) . It work fine for me
I accidentally had a value in the Client Secret part of the URL, but Google Credential does not need a Client Secret for Android OAuth 2 Client IDs. Simply leaving the value blank in the URL did the trick for me.
Steps that worked for me:
Delete credentials that are not working for you
Create new credentials with some NAME
Fill in the same NAME on your OAuth consent screen
Fill in the e-mail address on the OAuth consent screen
The name should be exactly the same.
Another thing to check:
When you install the GoogleAPIs into a .Net app with NuGet, it will inject a new set of dummy values in your *.config file.
Check that any original values are still in place, and remove dummy entries.
Deleting client ID and creating new one a couple of times worked for me.
Mine didn't work because I created it from a button from the documentation. I went again to the project and created another OAuthClientID. It worked. Yes, be careful about the extra spaces on right and left too.
For best results make sure you have the complete details as follows:
{"client_id":"282324738-4labcgdsd4nlh34885s2d34tmi.apps.googleusercontent.com","project_id":"abcd23ss-212808","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://www.googleapis.com/oauth2/v3/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"23452-dfgdfgcdfgfd","redirect_uris":["http://localhost:6900/auth/google/callback"],"javascript_origins":["http://localhost:6900"]}
This data is always available for download as JSON from https://console.developers.google.com/apis/credentials/oauthclient/
If you are in Meteor JS, you have to use clientId instead appId:
Since facebook uses appId and google clientId.
ServiceConfiguration.configurations.upsert({
service: "google"
}, {
$set: {
clientId: process.env.OAUTH_GOOGLE_APP_ID,
loginStyle: "popup",
secret: process.env.OAUTH_GOOGLE_SECRET
}
});
I spent some hours to realize over that.
I wish I had seen this post before, because there are a lot of things I had to find out trial and error. A lot can go wrong with this. Here's another issue I had:
Whe you specify the Authorised Javascript origins or Authorised redirect URIs, make sure to include your domain with and without www. So https://google.com and https://www.google.com
Also I had uploaded an Application logo. Because of that, the consent screen required a review... which takes forever. Don't upload an Application logo, or be very patient.
this could also be because of not using https url.
In other words,this only works with https. It works with http only in localhost
The solution that worked for me was to remove the ' single quotes and remove additional spaces at the end of the client id and secret in the .env file