WeChat SendAuth request for access token code only works once - android

I am following the WeChat Login documentation for Android and it works but only once and I can't repeat the process.
I use this code to get the access token code:
IWXAPI api = WXAPIFactory.createWXAPI(this, APP_ID, false);
SendAuth.Req request = new SendAuth.Req();
request.scope = "snsapi_userinfo";
request.state = "wechat_sdk_demo_test";
api.sendReq(request);
I have created the WXEntryActivty and I received the response from the WeChat app and I can finish the login process.
But if I reinstall my app and try to login with WeChat again I always get ERR_BAN (-6) error code. To make it work again I have to reinstall the WeChat app.
I could't find anything about when can I get ERR_BAN error code in the documentation. Can anyone help me with this problem?

I had many problems using Wechat API and testing directly on wechat app on my phone due to CACHE.
It's very difficult to flush wechat cache, i would say almost impossible, that's why you have to re install wechat to start your tests again.
I highly suggest you to use the desktop testing app for wechat, download it here, links are in the end of the page:
https://mp.weixin.qq.com/wiki?action=doc&id=mp1455784140
Then you will be able to debug every step of your development AND flush cache. Additionally you can link the software to your phone and debug what happens inside wechat web browser.

I managed to solve the problem. I copied the MD5 signature directly from the keytool's output which is contains colons :. I removed the colons from the signature and now it works correctly.
I think this is a bug in the WeChat app because the signature works with colons when the app displays the authorization page but not after that.

Related

Deeplinking Squareup pos app is not working

The documentation link: https://developer.squareup.com/docs/pos-api/build-mobile-web#step-5-test-your-code suggest straight forward code like this:
<a href="intent:#Intent;
action=com.squareup.pos.action.CHARGE;
package=com.squareup;
S.browser_fallback_url=https://my.website.com/index.html;
S.com.squareup.pos.WEB_CALLBACK_URI=https://my.website.com/index.html;
S.com.squareup.pos.CLIENT_ID=sq0ids-yourClientId;
S.com.squareup.pos.API_VERSION=v2.0;
i.com.squareup.pos.TOTAL_AMOUNT=100;
S.com.squareup.pos.CURRENCY_CODE=USD;
S.com.squareup.pos.TENDER_TYPES=com.squareup.pos.TENDER_CARD,com.squareup.pos.TENDER_CASH;
end">Start Transaction</a>
I tested it and it does not open any link, my devide already have app installed.
When I try this code:
Take a QR code 2
It open play store app with squareup pos app information, I need to directly open the app and not play store screen of the app, is there any way?
*UPDATE:
I got transactions to work after adding S.com.squareup.pos.LOCATION_ID={{ my_location_id }}. The location ID can be found in Square Developer Portal > Locations. Also if the POS app is passcode protected, you have to open and login with passcode before sending transaction.
*END UPDATE
I've been working through this same issue. I still haven't gotten a transaction to work, but have at least gotten the app to open.
Make sure the CLIENT ID is your production application ID. NOT sandbox.
The WEB_CALLBACK_URI needs to match the Web Callback URL defined in your Square Developer Portal > Point Of Sale API.
I hope this helps. If you do figure this out and get transactions to work, please post your solution for me and others who are sure to run into this issue since the documentation is lacking.

Track APP Installs from Facebook

I'm following documentation as states:
https://developers.facebook.com/docs/ads-for-apps/mobile-app-ads/#advanced
Specifically: Measure App Installs
However, I did the following code:
com.facebook.AppEventsLogger.activateApp( this, APPLICATION_ID_FACEBOOK );
However, in dashboard, it doesn't detect the install:
Any tips?
LogCat outputs the following:
FacebookException: No attribution id returned from the Facebook application
Ok. Solved.
Basically for whoever faces this:
FACEBOOK APP must be installed in device.
USER must be logged in.
Thats it.
=)
Another great but hidden hint is to enable verbose logging via
FacebookSdk.addLoggingBehavior(APP_EVENTS)
The output is actually very helpful and even contains error analysis and descriptions.

jsOAuth PhoneGap and Android

I searched SE's archives, google, directly ripped this off and ran it and I've been on it for like 6 hours now.
Based on the link above (jsOAuth Library) I wrote my code and when I run it on my android, the inAppBrowser (correctly) redirects me to the twitter page where I'm supposed to get my pin. But instead of the pin, it shows "there is no request token for this page... " error.
I even deleted and registered a new app under a different name and got a new pair of Consumer key/secret. But that too did not budge.
This could be a possible solution but even the Boilerplate example is not working. I guess I'm not getting my request token. Any help?

I keep getting Validation Error: client_id provided in the request does not match any of the registered clients

This is driving me MAAAADDDD
I'm trying to implement "Log In With PayPal" on Android.
I'm using this sample app to try to get the login screen to show up. https://github.com/SeraphimSerapis/PayPal-Access-Android-Example
I have created an app on the https://devportal.x.com/ website as instructed, I just want to use OAuth 2.0, I did all the settings, no luck.
Also, followed the answer in here https://stackoverflow.com/a/16199165/546439 i.e. created a seller account on developers.paypal and clearly chosen login with paypal access and credentials etc, still no luck
I don't even know whether I should get the credentials from x.com or paypal.com, each of them give the same options but they return different keys, I am so lost.
Please help.
UPDATE: added auth URL I am sending
all of these are not working
https://identity.x.com/xidentity/resources/authorize?client_id=AXbPkxDchMYBBAWn2UExvLytvvbJDDXn6u-9nWNgF_J7SZmwQkdDTwxHkuKe&scope=https://identity.x.com/xidentity/resources/profile/me&redirect_uri=http%3A%2F%2Faccess.com%2Findex.php&response_type=code
https://identity.x.com/xidentity/resources/authorize?client_id=ATL6BhBqBYAwJnolhJDT04El5GtxxDzTMAQEb5kkCdZVDrMr_v5bWlPpw7nN&scope=https://identity.x.com/xidentity/resources/profile/me&redirect_uri=http%3A%2F%2Faccess.com%2Findex.php&response_type=code
https://identity.x.com/xidentity/resources/authorize?client_id=6956fcaf5d9fb4bbea22af7ce7f4cc7a&scope=https://identity.x.com/xidentity/resources/profile/me&redirect_uri=http%3A%2F%2Faccess.com%2Findex.php&response_type=code
This error meaning that you are sending wrong client_Id "or not sending it" within the URI asking for token which is sent to authorize URL /authorize?client_id={client_id}, please share your URI to check it.
client_id string Unique client identifier obtained through the
application registration process. Required.
from https://developer.paypal.com/webapps/developer/docs/api/
I stumpled across a similar problem. I already hat an REST app running and tried to implement PayPal Login. Everytime I tried to use the sandbox client_id I got the same error message as you.
Took me some time to figure out, that, in my own stupidity, I tried to call
https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize
instead of
https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize
Now everything works for me
I had faced the same issue, I know this is a old issue and my solution may not be of much help. But I felt like sharing my fix.
I use devise for authentication and I wanted to implement PayPal login.
I configured omniauth for paypal inside config/initializers/devise.rb file. But by default the authentication path was "https://www.paypal.com/". As #Ello mentioned in his answer we need "https://www.sandbox.paypal.com/" url path for sandbox.
Then I figured out that we can change the url path to sandbox by passing sandbox as true in omniauth configuration.
So this is what I did in devise config file to resolve the issue
config.omniauth :paypal, PAYPAL_CLIENT_ID, PAYPAL_APP_SECRET, scope: PAYPAL_PERMISSIONS, sandbox: true

Android: Error when login Facebook using new Facebook SDK v3.0.2.b sample

when I using new Facebook SDK v3.0.2.b sample HelloFacebookSample, I login to Facebook but I get error:
HelloFBSample is misconfigured for Facebook login.
But I have already generate Hash key and add it to Sample App Setting on Facebook Developer site.
Is anybody get the same defect?
Or is it a bug of new SDK?
Sometimes the Key Hash generated using the method given by the Facebook Doc does not always work as advertised. I have faced this problem and so have a few others.
There are a couple of things you can do to sort it out.
First method
Follow the tutorial on this site: http://www.helloandroid.com/tutorials/using-facebook-sdk-android-development-part-1
This is a little time consuming (about 5 odd minutes I expect) but worked when I tried it.
Second Method (And I personally like this one)
Find the Util.java in the Facebook SDK and open it.
Among the first few lines of code, you should see this piece: private static boolean ENABLE_LOG = false;.
Change the false to true and run your application with your logcat (DDMD) open.
You should see an error that looks something like this:
Login failed: invalid_key:Android key mismatch. Your key
"**real*key***" does not match the allowed keys specified in
your application settings.
If this is for a testing APK, using the debug.keystore, this will be enough. However, if this is for an app signed with your release key, then follow the steps till Step No. 3 but instead of pushing the app from eclipse, create a signed APK and install that on your device. Don't forget to keep it connected with DDMS running.
This part here: "**real*key***" is your actual key.

Categories

Resources