Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Instagram verification #19

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

anthonygraignic
Copy link

Hi,
I added a Instagram verification for Ceramic's Identity Link Services.

As our product(Wallkanda) is dealing with artists, asking them to post an image with the did in description on their beautiful wall or even in bio can be very hard to accept so I decided to take advantages of existing OAuth API of this kind of social services to provide a private & secure way of verifying their account.
But tell me if I'm wrong and the user should actually post something public.

It uses the OAuth2 Authorization Code Grant Type ( RFC 6749 or auth0 doc of the Instagram OAuth server to get the username and id.
More info about the Authorization Window from Instagram

I made a quick sequence diagram:

I chose to make the instagram_request a HTTP GET request with username & did (it should not cause privacy problem as it's public info) to provide a convenient way to redirect user directly (when setting the INSTAGRAM_HTTP_REDIRECT env var).
I don't know if it's a good idea or if I should stick with the POST method but please tell me :)

The trick is that the challengeCode is passed through to Instagram API thanks to the state query param that will be set when using the INSTAGRAM_REDIRECT_URI that redirects to our website.

Any feed back is appreciated :)

Requirements

Things left to do

  • Fix the test request_instagram (HTTP GET) in api_handler.test.js
  • Make a demo website

Add instagram routes & register in api handler
Add dedicated mgr
Add analytics functions for Instagram verification
Add overall logic for instagram-request
Add working instagram-verify
Init tests with error testing
Update verify method from GET to POST
Update function & tests
Fix tests for instagram-request
Remove tmp logs in instagramMgr
Add check on username in instagramMgr read from redis
Add tests for instagramMgr
Add env var INSTAGRAM_HTTP_REDIRECT to enable 307 redir or not
Remove useless did in Instagram query  param
Add missing env var INSTAGRAM_HTTP_REDIRECT in serverless.yml
Fix failing tests due to previous update
Add new line at the end of .template.env
@oed oed requested review from zachferland and oed March 22, 2021 08:52
Copy link
Member

@oed oed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool @anthonygraignic!

Seems like a good approach. The main difference between having a public post of the did is that the claim will be publicly verifiable by any third party. It's fine to do it in this way if you are fine with a larger trust assumption in the verification service.

Would love to see a demo website so that I can easily try this out before merging!

@@ -12,7 +12,7 @@

<!-- ALL-CONTRIBUTORS-BADGE:END -->

> A decentralized identifier (DID) verification service for Ceramic. Available methods include Twitter, Discord, and Github.
> A decentralized identifier (DID) verification service for Ceramic. Available methods include Twitter, Discord, Instagram and Github.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess discourse should be here as well 😅

@anthonygraignic
Copy link
Author

Very cool @anthonygraignic!

Seems like a good approach. The main difference between having a public post of the did is that the claim will be publicly verifiable by any third party. It's fine to do it in this way if you are fine with a larger trust assumption in the verification service.

Would love to see a demo website so that I can easily try this out before merging!

Thanks for the feedback !
Yes I get the public part, I will start that way and see if it is a problem. Maybe putting the did in the bio isn't a real problem 🤷‍♀️

Perfect, will do one and ping you !

@oed
Copy link
Member

oed commented Apr 6, 2021

Any update here @anthonygraignic ?

@anthonygraignic
Copy link
Author

anthonygraignic commented Apr 6, 2021

Any update here @anthonygraignic ?

I'm on vacation and didn't had time to finish it before leaving sorry. It should be fine by the end of next week as I will be back.

@oed
Copy link
Member

oed commented Apr 6, 2021

Ok, np! 🌴

@oed oed self-assigned this Apr 14, 2021
# Conflicts:
#	packages/server/serverless.yml
#	packages/server/src/api_handler.js
#	packages/utils/scripts/generateKeyPair.js
@anthonygraignic
Copy link
Author

Hi, sorry for the very long radio silence ! I'm clearly not the best contributor this time 😅

But I finally managed to find the time to deploy the services and make a sample app !
It's available at https://elastic-bartik-d64c0a.netlify.app/ and running on clay testnet.

I used the new Self.ID SDK and you can browse the source code here: https://github.com/anthonygraignic/ceramic-identitylink-instagram-example-website

The UX can be improved as you have to login a second time to generate the VC. I will try to find a solution for that, but it's working :)

I made a GIF of the full workflow :
identity-link-services-insta-2021-10-27 09-15
For the test I had an unlocked Metamask and as I did a few iterations my 3ID Connect was operational (no additional modals or web3 signatures)

Don't hesitate to tell me if I need to make change to my code !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants