How to automatically and programmatically follow wechat OA after using wechat login API? - wechat

User flow
User clicks on wechat link on the website
User is redirected to the wechat QR code for logging in to the web site.
User logs in to the website successfully after scanning the QR code.
After successful logging in, I want users to automatically subscribe/follow the OA(subscription account).
Can you please let me know if its possible and if possible can you please guide me to the relevant resource to achieve this functionality

Although I do not know of any guide pointing how to do that, I implemented it myself for a woocommerce-based site.
user lands on the page
the system authenticates the user (with the WeChat User Info interface https://api.weixin.qq.com/sns/userinfo)
the system checks if the user is a follower (with the WeChat User Info interface https://api.weixin.qq.com/sns/userinfo)
if the user is not a follower, a QR code to follow the OA is displayed (QR code pulled from the weChat interface https://mp.weixin.qq.com/cgi-bin/showqrcode)
the user scans the code and follows
the system receives an "subscribed" event (XML event)
the system checks the last page visited by the user
the system sends a welcome message to the user (XML response of type news)
the user interacts with the welcome message to go back to the original page

Related

No lists available even with API configured and list created at mailchimp.com account

No lists available even with API configured and list created at mailchimp.com account
What am I missing here?
1) Created account at mailchimp.com
2) Created an API key and inserted it into PMPro mailchimp
Any one help me..
Navigate to MailChimp’shomepage and click Sign Up Free.
On the Get Started page, type in your Email, Username, and Password, and click Get Started!
We’ll display a confirmation message. Check your inbox for the account activation email to complete your account setup.
Note
The time it takes to receive the activation email can vary. If you haven’t received the activation email, check your spam folder. You can also activate your account from the login page when you input your credentials and click Log In.
MailChimp blocks signups from role-based email addresses like admin#hathaway.edu or security#hathaway.edu.
Activate Your Account
After you receive the account activation email from MailChimp Client Services, you can complete the account setup.
Open the account activation email and click Activate Account.
On the Confirm Humanity screen, check the I’m not a robot box, and click Confirm Signup.
For more info refer this link http://kb.mailchimp.com/accounts/account-setup/create-an-account

Get user profile info instead of user card with Google Identity Toolkit

How do I get the user profile information such as user name, email id, profile picture, basically all the information that is displayed in the user card, in my Javascript client?
I do not want to use the default user card that is displayed for a signed in user while using the Google Identity Toolkit.
I cannot find this information in the official documentation. The documentation does say that we can customize the look and feel of the user card, but I could not figure out how to get the profile information, which is displayed in the user card.
I'm using my own Login and Logout buttons. I would like to handle the display of user profile information in my own way too.
My application is hosted on GAE with Java.
You can use the java server library to parse the gitkit id token and retrieve all the information you need:
https://github.com/google/identity-toolkit-java-client/tree/master/src/main/java/com/google/identitytoolkit

Generating WeChat QR Codes

I' working on a login page where I want to use WeChat as login option and I have a WeChat official account. In my understanding of the documentation it's supposed that the next link would generate a QR code to scan and after the user authorization redirects somewhere else...:
https://open.weixin.qq.com/connect/qrconnect?appid=wx8bxxx21bxxxx0fxxx&redirect_uri=https://myhostname/oauth2.php&response_type=code&scope=snsapi_login&state=101#wechat_redirect
But the link doesn't work. I don't know if I'm missing something or maybe the site https://myhostname/oauth2.php has to have a previous authorization call to WeChat... ???
Somebody has worked with this WeChat stuff?
Thanks in advance!
I realized later that you must have a WeChat Open Platform Account, where you register your web application, wait for approval, and then give it the login permission to get access to that QR Code functionality
If you are working on how to login web page after scanning qrcode of an offical account on the web page.
There are two ways to approach this.
Scan service official account
You can generate the qrcode injected with parameters. then after you scan, there will be an event triggered in your backend.
Capture the event and extract the parameter, then do the authentication in the way you want.
The basic workflow:
app frontend request your backend for a session.
app backend call wechat api to generate a qrcode, injecte with any parameter you like.
app frontend show the qrcode.
user scan the qrcode of the service account.
if user did not subscribe, then subscribe the official account.
backend receive the scan event, extract the info and authenticate the user.
Scan subscription official account
In subscription get less programing support, but you can still achieve it by design a random code.
The basic workflow:
app frontend request your backend for a session.
app backend generate a random code.
app frontend show the qrcode of the official account with a random code.
user scan the qrcode of the subscription official account.
if user did not subscribe, then subscribe the official account.
user input the random code in the official account message UI.
backend receive the code and authenticate the user.
attach user info in your db with openid if you want.
Use an open platform to do it in the smart way.
If you doing this for one official account, it is ok. Let's say if you want to reuse this for multiple official accounts.
Maybe can use the open platform way, so you can have only 1 backend to handle multiple accounts.
Wechat offer an open platform, here is the get start doc.
Register an open platform need to pay 300RMB for verification, more troublesome part is, you need to register a company to be qualified to pay.
So maybe using a third party open platform will be a better choice. Such as Dagui Qrcode Tool.
Key take aways
Use parameter Qrcode for service official account login
Use account qrcode with random code for subscription official account login
Use open platform for scaling
Authentication is flexible, the key is the event exchange flow.
More secret technology related to wechat development, can refer this article
You need to set the OAuth2.0 web authorization domain to your subdomain in your redirect url, such as: wechat.myredirectdomain.com.
This setting is hidden on the WeChat official account dev setting dashboard, some where in between the API list, make sure you set it properly.

How to detect if a user has logged in to flickr?

What is the right way to find out if a user has logged in to Flickr? I have an iframe in my application which lets user's download their images from Flickr. But if the user is not logged into flickr, then flickr redirects me OUT of the iframe to the yahoo home page.
I would like to do the following:
- Check if the user has logged into flickr, if he has, then download his images in the iframe.
- Else, open a new browser window which will let the user enter his flickr login credentials.
Any suggestions from the experts?
You should use the Flikr API. You need to setup proper flikr authentication in your app. According to the docs, the authentication should flow like this:
Our web based app has the api key
'1234567890'. It has already
registered a callback url for this key
- 'http://viewr.com/auth.php'.
User visits http://viewr.com/ and clicks on the 'login' link.
This link points to http://flickr.com/services/auth/?api_key=1234567890&perms=read&api_sig=2f3870be274f6c49b3e31a0c6728957f.
The user is already logged in to flickr - they are asked if they wish
to allow the application to have
'read' permissions to their photos.
The user clicks 'yes' and flickr updates it's auth database.
The user is redirected to http://viewr.com/auth.php?frob=abcxyz.
-The app makes a background call to flickr.auth.getToken:
http://flickr.com/services/rest/?method=flickr.auth.getToken&api_key=1234567890&frob=abcxzy&api_sig=3f3870be274f6c49b3e31a0c6728957f.
The call returns an auth token '334455'.
The application stores the auth token and creates a session for the
user with a cookie which points to the
user's auth token.
The application makes a background request to the flickr.people.getInfo
to return information about the user,
by calling
http://flickr.com/services/rest/?method=flickr.people.getInfo&api_key=1234567890&auth_token=334455&api_sig=4f3870be274f6c49b3e31a0c6728957f.

Facebook API, Using FB Connect on email address

ASP.Net C# and FaceBook Connect.
I'm using Facebook connect on my site. If a new user connects through FB i create an account for them and all is fine. What i would also like to do is check to see if they already have a registered account.
So if someone connects that has not logged in but has an account i would like to be able to locate the account in my application a link it. I hoping this could be done via the email address?
Any ideas
Thanks
Richard
UPDATE: You need Connect.registerUsers:
This method is used to create an
association between an existing user
account on your site and that user's
Facebook account, provided the user
has not connected accounts before.
This method takes an array of account
data, including a required email_hash
and optional account data. For each
connected account, if the user exists,
the information is added to the set of
the user's connected accounts. If the
user has already authorized the site,
the connected account is added in the
confirmed state. If the user has not
yet authorized the site, the connected
account is added in the pending state.
If the user deactivates their external
user account, then call
connect.unregisterUsers. To get the
number of friends a user has in the
pending state, use
connect.getUnconnectedFriendsCount.
If that doesn't resolve your question, this question is not a duplicate of yours, but the answers might give you a way forward:
How do we register users — Facebook Connect users logging in the first time — when we cannot get an email address from facebook?

Resources